Newer Version Available

This content describes an older version of this product. View Latest

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);