Description
Pads the end (right side) of a string with a specified character until it reaches the desired length.Syntax
Parameters
Returns
Type: string The padded string. If the original string is already longer than the target length, it is returned unchanged. Returnsnull if input is null.
Examples
Example 1: Basic Right Padding
Example 2: Creating Fixed-Width Fields
Example 3: Building Formatted Tables
Notes
- Returns
nullif input isnull - Converts numbers to strings automatically
- Default padding character is a space
- If string is already longer than target length, returns original string
- Useful for creating aligned columns, fixed-width output, or formatted tables
See Also
- text.lpad - Pad the start (left side) of a string
- text.repeat - Repeat a string multiple times
- text.format - Format strings with placeholders
Frequently Asked Questions
What happens if the string is already longer than the target length?
What happens if the string is already longer than the target length?
The original string is returned unchanged — no truncation occurs.
What is the default padding character?
What is the default padding character?
The default padding character is a space
' ' if no padChar argument is provided.