Singleton
caplin.element.parser

ThousandsParser

Implements caplin.element.Parser.
Parses an amount and strips any thousands separators.

ThousandsParser is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to "8987551787.0":

caplin.element.parser.ThousandsParser.parse("8,987,551,787.0", {}) The number grouping separator will change per locale. The english separator defaults to "," as in the example above, see the i18n property ct.i18n.number.grouping.separator in other locales for their separators.

See caplin.element.formatter.ThousandsFormatter for the complementary formatter.

Constructor Summary

Attributes Name and Description
caplin.element.parser.ThousandsParser()

Method Summary

Attributes Name and Description
String parse(Variant vValue, Map mAttributes)

Parses an amount, strips any thousands separators and changes the local radix (decimal point) char into a ".

Constructor Detail

caplin.element.parser.ThousandsParser()

Method Detail

String parse(Variant vValue, Map mAttributes)

Parses an amount, strips any thousands separators and changes the local radix (decimal point) char into a ".".

Attribute Options:

Option Description
separator the token representing thousands (defaults to a comma in en_GB locale)

Parameters
Variant vValue the amount.
Map mAttributes the map of attributes.
Returns
the amount, with any number grouping separators removed