Skip to content

PrePad

mapping category: string no `||`

Pads a string at the beginning with a given character until it reaches the requested size.

Expands the input string to the requested size by prepending the padding character. If the input string is already at or above that size, it is returned unchanged.

Parameters

1size Mandatory — accepts: INT

The size the input string should have after padding.

2padChar Optional — accepts: STRING

The character used to pad the string. Defaults to a single space.

Input type

  • STRING

Output type

  • STRING

Requires

  • The padding character can only be a single character and not a string.

Examples

Left-pad to size 5 with zeros

PrePad(5, "0")

Left-pad to size 10 with spaces

PrePad(10)

See also

PostPad, Truncate, Trim, InsertStringAt