Skip to main content

Overview

The format-number transformation formats a number according to the specified style, locale, and decimal options.

Syntax

format-number(<variable>, style="decimal")

Parameters

ParameterTypeRequiredDescription
variablenumberYesThe number to format
stylestringYesFormatting style: "decimal", "percent", or "unit"
unitstringNoThe unit to use when style is "unit" (e.g., "kilometer", "celsius")
localestringNoThe locale for formatting (e.g., "en-US", "fr-FR"). Defaults to "en-US"
minDecimalnumberNoMinimum number of decimal places
maxDecimalnumberNoMaximum number of decimal places

Examples

format-number(<variable>, style="decimal", locale="fr-FR")
format-number(<variable>, style="percent", minDecimal=1, maxDecimal=2)
format-number(<variable>, style="unit", unit="kilometer", locale="en-US")