strCenterPad

Pads equal space on both sides of a string. An equal number of spaces is added to each side of the string to make it at least the specified length. A character will be added to the length of the string if required.

Note:

Use the Special String Operators for string concatenation, string inclusion, and simple comparison.

Type and Usage

Parameters

Takes two parameters:

  • The first parameter is the string.

  • The second parameter is the string length.

Output

Returns a string with spaces on both sides.

Example

Pads equal space on each side and creates a string seven characters long, using the form <space><space>inf<space><space>:

<$strCenterPad("inf", 7)$>

Pads equal space on each side and creates a string nine characters long, using the form <space><space><space>inf<space><space><space>:

<$strCenterPad("inf", 8)$>

Pads equal space on each side and creates a string nine characters long, using the form <space><space><space>inf<space><space><space>:

<$strCenterPad("inf", 9)$>