Caplin Trader 4.5.2

Class: module:caplin/element/parser/LocalisedAmountParser

module:caplin/element/parser/LocalisedAmountParser

Constructor

new module:caplin/element/parser/LocalisedAmountParser()

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 @link module:caplin/element/formatter/AmountFormatter} for the complementary formatter.
Implements:

Methods

parse(sValue, mAttributes) → {String}

Parses an amount containing a thousands, millions or billions token into a number. If the amount does not match, then null is returned.
Parameters:
Name Type Description
sValue Variant the amount with tokens
mAttributes Object the map of attributes.
Returns:
the numeric amount, or null if the value was not recognized.
Type
String