Skip to main content

Format as currency or unit

Write a number as money (1,234.50 EUR in the locale's way), as a percentage (15%) or with a unit (12.5 kg).

Command in the Number toolkit · id ooa.number/format_as · 8 inputs (1 required), 1 output

Inputs​

InputTypeRequiredDefaultWhat it is
ValueNumberYesNumber to format.
StyleStringNocurrencyMoney, percentage or a number with a unit.
CurrencyStringNoUSDThree-letter currency code, e.g. USD, EUR, GBP, INR, JPY.
UnitStringNoThe unit, e.g. kg, hours, pcs, km/h.
LocaleStringNoen-USLocale for separators and symbol position, e.g. en-US, de-DE, en-IN, fr-FR.
DecimalsNumberNoDecimal places; empty: the currency's own (2 for EUR, 0 for JPY), 0 for percent, as given for units.
Value is a fraction (0.15 is 15%)BooleanNotrueWhen ticked 0.15 shows as 15%; when not, 15 shows as 15%.
Unit before the numberBooleanNofalseWrite the unit first, e.g. Rs 120 instead of 120 Rs.

Outputs​

OutputTypeWhat it is
textStringThe formatted text.