STR_PAD

Use the STR_PAD script function to extend a string to a certain length. Do so by adding a specified number of characters on the right, on the left, or on both sides of this string.

Syntax

STR_PAD (String, [Character], Total length, Alignment)

Parameters

Return code: the extended string

Examples

The following example shows three ways of extending a string that has 20 characters to a final length of 31 characters. The result is shown in the activation report.

:SET &STRING# = "String for Scripting"
:SET &STRLEN# = 31
:SET &STRNEW# = STR_PAD(&STRING#, ".", &STRLEN#, "LEFT")
:PRINT &STRNEW#
:SET &STRNEW# = STR_PAD(&STRING#, "+", &STRLEN#, "CENTER")
:PRINT &STRNEW#
:SET &STRNEW# = STR_PAD(&STRING#, "_", &STRLEN#, "RIGHT")
:PRINT &STRNEW#

The following result is written to the activation report:

String for Scripting...........
+++++String for Scripting++++++
___________String for Scripting

See also:

seealso

Script Elements for Editing Strings