functx:pad-integer-to-length

Pads an integer to a desired length by adding leading zeros

Description

The functx:pad-integer-to-length function returns $integerToPad concatenated with enough leading zeros to make its length $length. The function will raise an error if $integerToPad is longer than $length.

Parameters

Description

integerToPad:integer()

the integer to pad

length:integer()

the desired length

Examples

XPath

Results

functx:pad-integer-to-length(12,6)

000012

functx:pad-integer-to-length(1, 6)

000001

functx:pad-integer-to-length(12, 2)

12

Depends On

See Also