Class jsworld.MonetaryParser
Class for parsing localised currency amount strings.
Defined in: <JsWorld.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
jsworld.MonetaryParser(locale)
Creates a new monetary parser for the specified locale.
|
Method Attributes | Method Name and Description |
---|---|
parse(formattedCurrency)
Parses a currency amount string formatted according to
the preset locale.
|
Class Detail
jsworld.MonetaryParser(locale)
Creates a new monetary parser for the specified locale.
- Parameters:
- {jsworld.Locale} locale
- A locale object specifying the required POSIX LC_MONETARY formatting properties.
- Throws:
- Error on constructor failure.
Method Detail
{Number}
parse(formattedCurrency)
Parses a currency amount string formatted according to
the preset locale. Leading and trailing whitespace is ignored; the
amount may also be formatted without thousands separators. Both
the local (shorthand) symbol and the ISO 4217 code are accepted to
designate the currency in the formatted amount.
- Parameters:
- {String} formattedCurrency
- The formatted currency amount.
- Throws:
- Error on a parse exception.
- Returns:
- {Number} The parsed amount.