Cicode Programming Reference > Cicode Function Categories > String Functions Introduction > StrPad

StrPad

Pads a string with a number of occurrences of another string. Padding can be added to the left or to the right of a string. If the string is already longer than the required string length, the string is truncated.

Syntax

StrPad(String, PadString, Length)

String:

The source string.

PadString:

The padding string.

Length:

The length of the string. If a positive length is specified, padding will be added to the right of the string. If a negative length is specified, padding will be added to the left of the string.

Return Value

A padded string.

Related Functions

StrFill

Example

Variable=StrPad("Test"," ",10);
! Sets Variable to "Test ".
Variable=StrPad("Test","abc",-14);
! Sets Variable to "abcabcabcaTest".

See Also

String Functions