rpad

To fill up a given length with a given padding at the end

With this function, you fill a text at the end, i.e. to the right of the text, with one or more specified characters up to the desired total length. The given characters are repeated until the given total length is reached.

This can be very useful when - for technical reasons - data must have a certain length, or for optical padding in print layouts in a non-proportional font.

If the source text already reaches or exceeds the specified length, it remains unchanged.

Syntax

rpad(string, number, string)

Return

string

Examples

rpad(myText, length, padding) To fill up a given length with given padding at the end, if the given text is shorter than the given length.

rpad("A text", 20, " +")

Result: A text + + + + + + +

rpad(text(123), 8, "0")

Result: 12300000

See also

lpad, which fills up a given length with given padding at the beginning.

Last updated