Singleton
caplin.element.formatter

DecimalFormatter

Formats the value to the specified number of decimal places.

DecimalFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to "3.142": If you are using this formatter in conjunction with the ThousandsFormatter in a localised application, please ensure this DecimalFormatter comes before the ThousandsFomatter in the renderer xml, otherwise localised decimal point characters will stop the DecimalFormatter from recognising the number.

caplin.element.formatter.DecimalFormatter.format(3.14159, {dp:3})

Constructor Summary

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

Method Summary

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

Formats the value to the specified number of decimal places.

Constructor Detail

caplin.element.formatter.DecimalFormatter()

Method Detail

String format(Variant vValue, Map mAttributes)

Formats the value to the specified number of decimal places.

Attribute Options:

Option Description
dp the number of decimal places to apply.

Parameters
Variant vValue the number (String or Number type).
Map mAttributes the map of attributes.
Returns
the number, formatted to the specified precision.