github axuno/SmartFormat v3.0.0

latest releases: v3.5.1, v3.5.0, v3.4.0...
2 years ago

Changes since v3.0.0-rc.2

SubStringFormatter

The formatter now accecpts a format argument with a nested Placeholder that lets you format the result of the sub-string operation.
Example: Convert the sub-string to lower-case:

Smart.Format("{0:substr(0,2):{ToLower}}", "ABC");

Reasoning: Enhancement

Nullable Notation

KeyValuePairSource, PersistentVariablesSource and GlobalVariablesSource can now process "null if nullable"
Reasoning: Enhancement

TemplateFormatter

The name of the formatter is now "t" (was "template" before).
Reasoning: Minimize the format string

Char to split options and formats is limited to pipe, comma, tilde

  • Char to split options and formats is limited to pipe, comma, tilde
  • SplitChar for formatters is unified and checked for validity
  • Affects ChooseFormatter, ConditionalFormatter, IsMatchFormatter, ListFormatter, PluralLocalizationFormatter, SubStringFormatter

Reasoning: Avoid conflicts with reserved characters

Modified ChooseFormatter case-sensitivity for option strings

  • bool and null: always case-insensitive
  • using SmartSettings.CaseSensitivity unless overridden with ChooseFormatter.CaseSensitivity
  • option strings comparison is culture-aware, using CultureInfo if supplied in Smart.Format(...) or CurrentUICulture

Reasoning: Enhancement

Magic Leading Colon

An implementation of a magic leading colon in order to identify whether ConditionalFormatter or PluralLocalizationFormatter should be invoked, was removed.
Reasoning:
This is undocumented and unnecessary.
Adding the formatter name in the format string achieves the same target.

Don't miss a new SmartFormat release

NewReleases is sending notifications on new releases.