padString

Description

Generates a padded text. A padded text has additional characters added to either its beginning, end, or both sides to achieve a desired length or formatting.

Input / Parameter

NameDescriptionInput TypeDefaultOptionsRequired

string

The value to be padded.

String/Text

-

-

Yes

len

The length of the new padded text.

Number

0

-

Yes

type

The location of the 'string' within the new padded text.

String/Text

right

right, left, center

Yes

char

The value to use as padding.

String/Text

' '

-

No

Output

DescriptionOutput Type

Returns the padded value.

String/Text

Callback

N/A

Video

Coming soon.

Example

The user wants to add padding to a string with maximum length of 10, with the original string at the center.

Step

  1. Call the function console. Call the function padString inside the value parameter of the console function. string: AB len: 10 type: center char: 1

Result

There are 4 characters '1' added on both the left & right side of "AB", making the total length of the string 10.

Last updated