Overview
This function formats a number according to a given style in a given region.Parameters
- Variable: The number to format.
- Style: The desired format.
- none: No formatting, just the plain number.
- currency: Formats as local currency (e.g., $1,234.56 or R$ 1.234,56).
- decimal: Standard decimal formatting with grouping separators (e.g., 1,234.56).
- percent: Formats as a percentage (e.g., 50%).
- scientific: Scientific notation (e.g., 1.23E3).
- spellOut: Spells the number in words (e.g., one thousand two hundred thirty-four).
- ordinal: Formats as an ordinal number (e.g., 1st, 2nd, 3rd).
- currencyISOCode: Currency with ISO code (e.g., USD 1,234.56).
- currencyPlural: Currency formatted using plural rules (e.g., 1 dollar, 2 dollars).
- currencyAccounting: Currency formatted for accounting (e.g., negative numbers in parentheses: ($1,234.56)).
- Region: The desired region, formatted like
"en_US"for USA English or"pt_BR"Brazil Portuguese. Learn more here.
Examples
"$1,234.56", the correct format for US Dollars.
"£1,234.56", the correct format for Great British Pound.
"R$ 1.234,56", the correct format for Brazillian Reais.
