Singleton
caplin.element.parser

AmountParser

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

AmountParser 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.AmountParser.parse("4.9MM", {})

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

Constructor Summary

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

Method Summary

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

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

Constructor Detail

caplin.element.parser.AmountParser()

Method Detail

String parse(Variant vValue, Map 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 vValue the amount with tokens
Map mAttributes the map of attributes.
Returns
the numeric amount, or null if the value was not recognized.