Replies: 1 comment 1 reply
-
Hi Jeff: I gave it a try with the following /// <summary>
/// Gets the character indicating the start of a <see cref="Placeholder"/>.
/// </summary>
internal char PlaceholderBeginChar { get; } = '[';
/// <summary>
/// Gets the character indicating the end of a <see cref="Placeholder"/>.
/// </summary>
internal char PlaceholderEndChar { get; } = ']';
/// <summary>
/// Gets the character indicating the begin of formatter options.
/// </summary>
internal char FormatterOptionsBeginChar { get; } = '(';
/// <summary>
/// Gets the character indicating the end of formatter options.
/// </summary>
internal char FormatterOptionsEndChar { get; } = ')';
/// <summary>
/// Gets the character indicating the begin of a list index, like in "{Numbers[0]}"
/// </summary>
internal char ListIndexBeginChar { get; } = '`';
/// <summary>
/// Gets the character indicating the end of a list index, like in "{Numbers[0]}"
/// </summary>
internal char ListIndexEndChar { get; } = '´'; And then var smart = Smart.CreateDefaultSmartFormat(new SmartSettings
{
Parser = new ParserSettings {ErrorAction = ParseErrorAction.ThrowError, },
Formatter = new FormatterSettings {ErrorAction = FormatErrorAction.ThrowError}
});
var data = new {
One = 1,
ChildOne = new {
Two = 2,
ChildTwo = new {
Three = 3,
ChildThree = new {
Four = 4,
Four2 = 42
}
}
}
};
_ = smart.Format("[One][ChildOne.ChildTwo.Three]", data);
// Result: 13 So generally this should work at least for simple scenarios. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to change the braces for formatting in an RTF file
How can I use square brackets instead [ ]
Many thanks
Jeff
Beta Was this translation helpful? Give feedback.
All reactions