new module:ct-element /formatter /Leading Zero Formatter()
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':
LeadingZeroFormatter.format(89, {length:4})
- Implements:
Methods
format(vValue, mAttributes) → {String}
Pads the integer part of a number with as many leading zeros needed to reach the specified size.
Parameters:
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
vValue |
String | Number | the number. |
||||||||||
mAttributes |
Map |
the map of attributes. Properties
|
- Implements:
Returns:
the number, padded to the required length with leading zeros.
- Type
- String