ia.Formatter Class
Provides functions for formatting numbers and strings.
Constructor
ia.Formatter
()
Item Index
Methods
Methods
format
(
String | Number
-
value
-
precision
Formats a given string or number.
Parameters:
-
value
String | NumberThe value.
-
precision
NumberNumber of decimals. Uses the default precision if no argument is passed in.
Returns:
String | Number:
The formatted value.
formatNumber
(
Number
-
value
-
precision
Get a suitably formatted number.
Parameters:
-
value
NumberA number.
-
precision
NumberNumber of decimals. Uses the default precision if no argument is passed in.
Returns:
Number:
A number formatted for the current locale, for example
1.2 would be formatted as 1.2 in English, but 1,2 in EspaƱol. If the
argument passed in is NOT a number, it is returned unchanged.
formatText
(
String
-
txt
Get a suitably formatted string.
Parameters:
-
txt
StringA string.
Returns:
String:
A string formatted for the current locale.
unformat
(
Number
-
formattedValue
Unformats a given string back to its number.
Parameters:
-
formattedValue
StringThe formatted value.
Returns:
Number:
The value.
Properties
decimalSeparatorTo
String
The decimal separator
Default: "."
language
String
The language.
Default: "en"
noDataValue
String
The no data value.
Default: "No Data"
precision
Number
The precision.
thousandsSeparatorTo
String
The thousands separator
Default: ","