Format

formatMicronode

Writes a number with separators. Folded at compile time: the result is spliced into the surrounding text as characters, so no node reaches the renderer and the number cannot be re-formatted, animated or bound to afterwards. It emits separators only and never a currency symbol — the author writes the symbol, as in $!format:comma{{price}}(places: 2).

Explained in:Value primitives

#Attributes

asRequiredImplicit
Which form to write: comma groups the integer part in threes, percent scales by 100 and appends %, fixed uses places with no grouping, and scientific writes mantissa and exponent.Can be written as shorthand: format:value
places
number
Decimal places. Omitted, comma and percent keep the value's own decimals, fixed uses two, and scientific writes five mantissa decimals.

#Allowed content

Body { }A number

#Examples

The survey counted !format:comma{1234567} plants.
It covers !format:percent{0.4567}(places: 1) of the island.

#Notes

  • !format:comma{1234567} folds to 1,234,567; !format:percent{0.4567}(places: 1) to 45.7%; !format:fixed{3.1} to 3.10; !format:scientific{1234.5} to 1.23450e3.
  • The compiler carries no locale table, which is why there is no currency form: a symbol belongs to the sentence, not to the number.