functx:pad-string-to-length

Pads a string to a desired length

Description

The functx:pad-string-to-length function returns $stringToPad appended with enough repetitions of $padChar to make its length $length. The function will truncate $stringToPad if its length is greater than $length.

Parameters

Description

stringToPad:string()

the string to pad

padChar:string()

the character(s) to use as padding

length:integer()

the desired length

Examples

XPath

Results

functx:pad-string-to-length(‘abc’, ‘*’, 6)

abc***

functx:pad-string-to-length(‘abcdef’, ‘*’, 4)

abcd

functx:pad-string-to-length(‘’, ‘*’, 4)

See Also