strConfine

Confines a string to a maximum length and appends padding if necessary.

If the string equals or is shorter than the specified length, it is unaffected.

If the string is longer than the specified length, it is shortened and three padding characters are appended to equal the specified length. The character used for padding can be specified by changing the StrConfineOverflowChars variable.

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 maximum string length.

Output

Returns a string.

Example

Confines the string and appends three padding characters (dots) to make it a string five characters long, using the form in<dot><dot><dot>:

<$strConfine("inform", 5)$>

Confines the string and appends padding characters (dots) to make it a string five characters long, using the form i<dot><dot><dot><dot>:

<$strConfine("i", 5)$>

Confines the string to a maximum of ten characters in length, so this six-character string is unaffected:

<$strConfine("inform", 10)$>

Confines the string to a maximum of six characters in length, so this six-character string is unaffected:

<$strConfine("inform", 6)$>

See Also