xf:string-pad

Returns a string of made up of $decimal-var copies of $string-var concatenated together.

Signatures

xf:string-pad(xs:string? $string-var, xs:decimal? $decimal-var) —> xs:string?

Arguments

Data Type
Argument
Description

xs:string?

$string-var

Represents the string to replicate.

xs:decimal?

$decimal-var

Represents the number of times to replicate $string-var.

Returns

Returns a string of made up of $decimal-var copies of $string-var concatenated together.

Returns the value of $string-var1, if $string-var2 is a zero-length string ("").

Returns a zero-length string (""), if $decimal-var is equal to 0.

If the value of $string-var or $decimal-var is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.

Examples

This Query . . .
Generates This Result . . .

<r>{xf:string-pad("cat", 2)}</r>

<r>catcat</r>

<r>{xf:string-pad("super", 0)}</r>

<r/>

<r>{xf:string-pad("super", ())}</r>

<r/>

Related Topics

W3C string-pad function description.