- Description: Pads the right side of a string with a specified character.
- Purpose: Formatting output to a specific length.
- Syntax:
RPAD(string, length, [pad_string])
- Parameters:
string
: The original string.length
: Desired total length after padding.pad_string
: Character to pad with (defaults to space).
- Returns: The padded string.
- Example:
RPAD('123', 5, '0')
returns'12300'
. - Notes: Truncates if the original string is longer.
- Use Case: Preparing output for reports or displays.
Leave a Reply