Skip to main content

Pad text

Fill a text up to a length with a character on the left or the right, e.g. 42 to 00042; longer text is left as it is.

Command in the String toolkit · id ooa.string/pad · 4 inputs (2 required), 1 output

Inputs​

InputTypeRequiredDefaultWhat it is
TextStringYesSource text; a number is used as it is written, e.g. 42.
LengthNumberYesLength the result should have, in characters.
CharacterStringNo One character to fill with; a space when empty.
SideStringNoleftleft puts the fill before the text (numbers, codes); right puts it after (fixed-width columns).

Outputs​

OutputTypeWhat it is
resultStringThe padded text.