Description
Pads the start (left 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 Left Padding
Example 2: Formatting Numbers with Leading Zeros
Example 3: Aligning Text
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 formatting IDs, aligning columns, or creating fixed-width output
See Also
- text.rpad - Pad the end (right 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.