Caplin Trader 5.1.0

Class: module:ct-element/parser/LocalisedAmountParser

module:ct-element/parser/LocalisedAmountParser()

new module:ct-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'

LocalisedAmountParser.parse('4.9MM', {})

See @link module:ct-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