Singleton
caplin.element.parser

LocalisedAmountParser

Implements caplin.element.Parser.
Parses an amount containing a thousands, millions or billions token into a number.

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

caplin.element.parser.LocalisedAmountParser.parse("4.9MM", {})

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

Constructor Summary

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

Method Summary

Attributes Name and Description
String parse(Variant sValue, Object mAttributes)

Parses an amount containing a thousands, millions or billions token into a number.

Constructor Detail

caplin.element.parser.LocalisedAmountParser()

Method Detail

String parse(Variant sValue, Object mAttributes)

Parses an amount containing a thousands, millions or billions token into a number. If the amount does not match, then null is returned.

Attribute Options:

Option Description
thousands the token representing thousands (defaults to K)
millions the token representing millions (defaults to M)
billions the token representing billions (defaults to B)

Parameters
Variant sValue the amount with tokens
Object mAttributes the map of attributes.
Returns
the numeric amount, or null if the value was not recognized.