Caplin Trader 4.8.0

Class: module:br/parsing/LocalisedAmountParser

module:br/parsing/LocalisedAmountParser

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

LocalisedAmountParser is typically used with Presenter, but can be invoked programmatically as in the following example which evaluates to "4900000":

LocalisedAmountParser.parse("4.9MM", {})
See module:br/formatting/AmountFormatter for the complementary formatter.

Constructor

new module:br/parsing/LocalisedAmountParser()

Implements:

Methods

parse(sValue, 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:
Name Type Description
sValue Variant the amount with tokens
mAttributes Object the map of attributes.
Implements:
Returns:
the numeric amount, or null if the value was not recognized.