Singleton
caplin.element.formatter

RoundingFormatter

Formats the value to the specified rounding.

RoundingFormatter is typically used in the XML Renderer Framework, but can be invoked programmatically as in the following example which evaluates to "3.142":

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

Constructor Summary

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

Method Summary

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

Formats the number to the specified precision.

Constructor Detail

caplin.element.formatter.RoundingFormatter()

Method Detail

String format(Variant vValue, Map mAttributes)

Formats the number to the specified precision.

Attribute Options:

Option Description
sf the number of significant figures to apply (optional)
dp the number of decimal places to apply (optional)
rounding the number of decimal places to be rounded, omitting any trailing zeros (optional)

Parameters
Variant vValue the number.
Map mAttributes the map of attributes.
Returns
the number, formatted to the specified precision.