Singleton
caplin.element.formatter

SignificantFiguresFormatter

Formats a number to the specified number of significant figures.

SignificantFiguresFormatter 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.SignificantFiguresFormatter.format(3.14159, {sf:4})

Constructor Summary

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

Method Summary

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

Formats a number to the specified number of significant figures.

Constructor Detail

caplin.element.formatter.SignificantFiguresFormatter()

Method Detail

String format(Variant vValue, Map mAttributes)

Formats a number to the specified number of significant figures.

Attribute Options:

Option Description
sf the number of significant figures to apply (does nothing if omitted).

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