Singleton
caplin.element.formatter

LeadingZeroFormatter

Pads the integer part of a number with as many leading zeros needed to reach the specified length.

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

caplin.element.formatter.LeadingZeroFormatter.format(89, {length:4})

Constructor Summary

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

Method Summary

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

Pads the integer part of a number with as many leading zeros needed to reach the specified size.

Constructor Detail

caplin.element.formatter.LeadingZeroFormatter()

Method Detail

String format(Variant vValue, Map mAttributes)

Pads the integer part of a number with as many leading zeros needed to reach the specified size.

Attribute Options:

Option Description
size the minimum size of the padded number (defaults to zero)

Parameters
Variant vValue the number (String or Number type).
Map mAttributes the map of attributes.
Returns
the number, padded to the required length with leading zeros.