Singleton
caplin.element.formatter

AmountFormatter

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:

caplin.element.formatter.AmountFormatter.format(1234567890, {}) caplin.element.formatter.AmountFormatter.format(1234567890, {dp: 4})

Constructor Summary

Attributes Name and Description
caplin.element.formatter.AmountFormatter()

Method Summary

Attributes Name and Description
String format(Variant vValue, Map mAttributes)

Formats a number into an amount with a thousands, millions or billions token.

Constructor Detail

caplin.element.formatter.AmountFormatter()

Method Detail

String format(Variant vValue, Map mAttributes)

Formats a number into an amount with a thousands, millions or billions token.

Attribute Options:

Option Description
thousands token representing thousands (defaults to K).
millions token representing millions (defaults to M).
billions token representing billions (defaults to B).

Parameters
Variant vValue the numeric amount (String or Number type).
Map mAttributes a list of attributes, as specified here and in caplin.element.formatter.RoundingFormatter.
Returns
the tokenized amount.