-
-
Notifications
You must be signed in to change notification settings - Fork 105
Closed
Description
Hello,
I am upgrading SmartFormat to 3.2.1 from 2.7.2 and I am running into an issue adding a custom selector char. This is for replacing values in an XML, where the replacement key uses the $ sign to indicate the text that will get replaced.
In 2.7.2 I have code that looks like this,
var format = "{$number1$}";
Smart.Default.Parser.AddAdditionalSelectorChars(" $");
IDictionary<string, object> templateData = new Dictionary<string, object>();
templateData.Add("$number1$", "test");
Console.WriteLine(Smart.Format(format, templateData)); // prints: test, works as expected
In 3.2.1, I have modified the code to use the new AddCustomSelectorChars, so the code looks as follows,
var format = "{$number1$}";
Smart.Default.Settings.Parser.AddCustomSelectorChars(" $".ToCharArray());
IDictionary<string, object> templateData = new Dictionary<string, object>();
templateData.Add("$number1$", "test");
Console.WriteLine(Smart.Format(format, templateData));
// exception on the Format function that says,
// SmartFormat.Core.Parsing.ParsingErrors: 'The format string has 2 issues:
// '0x24': Invalid character in the selector, '0x24': Invalid character in the selector
// In: "{$number1$}"
Is there away to get this to work in 3.2.1?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels