getLocaleNumberFormat

function

Number format that depends on the locale.

See more...

getLocaleNumberFormat(locale: string, type: NumberFormatStyle): string

Parameters

locale

Type: string.

type

Type: NumberFormatStyle.

Returns

string

Description

Numbers are formatted using patterns, like #,###.00. For example, the pattern #,###.00 when used to format the number 12345.678 could result in "12'345,67". That would happen if the grouping separator for your language is an apostrophe, and the decimal separator is a comma.

Important: The characters . , 0 # (and others below) are special placeholders; they stand for the decimal separator, and so on, and are NOT real characters. You must NOT "translate" the placeholders; for example, don't change . to , even though in your language the decimal point is written with a comma. The symbols should be replaced by the local equivalents, using the Number Symbols for your language.

Here are the special characters used in number patterns:

Symbol Meaning
. Replaced automatically by the character used for the decimal point.
, Replaced by the "grouping" (thousands) separator.
0 Replaced by a digit (or zero if there aren't enough digits).
# Replaced by a digit (or nothing if there aren't enough).
¤ This will be replaced by a currency symbol, such as $ or USD.
% This marks a percent format. The % symbol may change position, but must be retained.
E This marks a scientific format. The E symbol may change position, but must be retained.
' Special characters used as literal characters are quoted with ASCII single quotes.

You can find more information on the CLDR website

© 2010–2019 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v6.angular.io/api/common/getLocaleNumberFormat