rpad(str: string, length: int64, [pad: string]?) -> string

Right-pads a string to a target length counted in Unicode scalar values (runes), repeating an optional pad string that defaults to a single space.

If str, length, or the optional pad argument is null where constant evaluation applies, the result is null. A negative length produces an empty string. When length is not greater than the string’s current length, the value is truncated on the right to exactly length characters. Padding repeats the pad string as needed and may use only a prefix of the final repetition to reach the exact length.

For padding on the other side, use lpad.

Domain

This is a scalar function (calculates a single output value for a single input row).

Categories

Examples

make_col label:rpad(status, 10)

Extends a short status string on the right with spaces so downstream fixed-width exports align cleanly.

make_col name_display:rpad(trim(name), 32, ".")

Right-pads a trimmed name with dots to a column width used for a simple text report layout.