Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

getNumberFormat()

Returns a NumberFormat object.

Signature

getNumberFormat(string format, string symbols)

Parameters

format
Type: string
The number format. For example, format=".00" displays the number followed by two decimal places.
symbols
Type: string
An optional map of localized symbols. Otherwise, the current locale’s symbols are used.

Returns

Type: NumberFormat
The number format returned by $Locale.numberFormat.

Sample Code

1var f = $A.get("$Locale.numberFormat");
2var num = 10000
3var nf = $A.localizationService.getNumberFormat(f);
4var formatted = nf.format(num);
5// Returns 10,000
6var formatted = $A.localizationService.formatNumber(num);