crozone / FormatWith

String extensions for named parameterized string formatting.
MIT License
73 stars 13 forks source link

Handle whitespace padding around parameters #29

Open crozone opened 3 years ago

crozone commented 3 years ago

Currently the tokenizer considers the entire contents of text between the open bracket and closed bracket the "key", including any whitespace that may be surrounding the actual text.

This is inconsistent with other formatters and the formatter built into the C# compiler.

Eg: abc{ Replacement1 } outputs the key " Replacement1 ", when it should really be "Replacement1".

Additionally, spaces are currently allowed in the middle of keys, which throws an "Unexpected Token" error in the C# compiler's string interpolation.

Both of these behaviours should eventually be configurable with a user specified setting value.

Items: