The goog.i18n.NumberFormat Class

goog.i18n.NumberFormat(pattern, opt_currency, opt_currencyStyle)

Constructor of NumberFormat.

pattern {number|string}
The number that indicates a predefined number format pattern.
opt_currency {string=}
Optional international currency code. This determines the currency code/symbol used in format/parse. If not given, the currency code for current locale will be used.
opt_currencyStyle {number=}
currency style, value defined in goog.i18n.NumberFormat.CurrencyStyle.

The goog.i18n.NumberFormat.CurrencyStyle Enum

Currency styles. … more

The goog.i18n.NumberFormat.Format Enum

Standard number formatting patterns. … more

.format(number)

Formats a Number to produce a string.

number {number}
The Number to be formatted.
returns {string}
The formatted number string.

.isEnforceAsciiDigits()

Return if Ascii digits is enforced.

returns {boolean}
If Ascii digits is enforced.

.parse(text, opt_pos)

Parses text string to produce a Number. This method attempts to parse text starting from position "opt_pos" if it is given. Otherwise the parse will start from the beginning of the text. When opt_pos presents, opt_pos will be updated to the character next to where parsing stops after the call. If an error occurs, opt_pos won't be updated.

text {string}
The string to be parsed.
opt_pos {Array.<number>=}
Position to pass in and get back.
returns {number}
Parsed number. This throws an error if the text cannot be parsed.

.setEnforceAsciiDigits(doEnforce)

Set if the usage of Ascii digits in formatting should be enforced.

doEnforce {boolean}
Boolean value about if Ascii digits should be enforced.

.setMaximumFractionDigits(max)

Sets maximum number of fraction digits.

max {number}
the maximum.

.setMinimumFractionDigits(min)

Sets minimum number of fraction digits.

min {number}
the minimum.