Caplin Trader 5.1.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

isSingleUseParser()

Allows parsers that should only run a single time, and that should not repeatedly re-parse their own output.

This method is optional. Parsers that don't implement it are not considered to be single-use parsers by default.

Implements:

parse(numericValue)

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
numericValue Variant

the amount with tokens

Implements:
Returns:

the numeric amount, or null if the value was not recognized.