Description

Pad string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length

Syntax

pad(text, length, chars)

Parameters

Input ParameterTypeDescription
textstringThe string to pad.
lengthnumberThe padding length.
charsstringThe string used as padding.

Return value

Type
string

Sample

ExampleResultDescription
pad('Sam', 8, ' ')' Sam 'Pad input text with given charcters
pad('Sam', 8, '-+')'-+Sam-+-'Pad input text with given charcters

To view all the String functions, click here.

See Also