new module:ct-element /parser /Amount 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"
AmountParser.parse("4.9MM", {})
See module:ct-element/formatter/AmountFormatter
for the complementary formatter.
- Implements:
Methods
parse(vValue, attributes) → {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 | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
vValue |
Variant | the amount with tokens |
||||||||||||||||||||
attributes |
Map |
the map of attributes. Properties
|
Returns:
the numeric amount, or null if the value was not recognized.
- Type
- String