new module:ct-element /formatter /Amount Formatter()
Formats a number into an amount with a thousands, millions or billions token.
AmountFormatter
is typically used in the XML Renderer Framework, but can be invoked programmatically
as in the following example which evaluates to '1.23456789B' and '1.230B' respectively:
AmountFormatter.format(1234567890, {})
AmountFormatter.format(1234567890, {dp: 4})
- Implements:
Methods
format(value, attributes) → {String}
Formats a number into an amount with a thousands, millions or billions token.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
value |
Variant | the numeric amount (String or Number type). |
||||||||||||||||||||
attributes |
Map |
a list of attributes, as specified here and in Properties
|
- Implements:
Returns:
the tokenized amount.
- Type
- String