Skip to main content

Text: Pad

Pad a string to a minimum character count by repeating a single fill character. Strings already at or above Length pass through unchanged (no truncation — pair with Text::Truncate if you need both).

Example
Length: 5, Fill: "0", Side: Left
Input: "42" → Output: "00042"

Length: 5, Fill: " ", Side: Right
Input: "hi" → Output: "hi "

Parameters

LengthREQUIRED
Minimum character count for the output.
Fill

Fill character — only the first character of the field is used. Defaults to a single space.

SideREQUIRED

Which side to add fill to: - Left — left-pad (fill before the input). - Right (default) — right-pad (fill after the input).

Input

StringREQUIRED
Text to pad.

Output

String
The padded text.