PadLeft

Top  Previous  Next

S

A

W

WS

ü

ü

Syntax -

PadLeft <variable name> <source value> <length> [<padding character>]

       Where:

       <variable name> is the user defined name that is assigned to the variable.

       <source value> is a literal string or a variable that contains a literal string.

       <length> is an integer or a variable that contains an integer.

       <padding character> is a single character literal string or a variable that contains a single character literal string.

Description:

This command is used to increase the length of a literal string by adding the <padding character> to the left of the first character of <source value> until the length of the literal string is equal to <length>. This padded literal string is stored as <variable name>.

 

Note: If <padding character> is not included in this command, a space is used.

 

Note: If the length of the <source value> is already greater than or equal to the <length> specified, the literal string assigned to the <variable name> is the <source value>.  This command cannot be used to truncate or shorten the length of the <source value>.

 

Sample:

       The following statement uses PadLeft to add zeros the beginning of a patient ID stored in the PTIDFromFile variable in order to make the value stored in ValidPID 11 characters long.

PadLeft ValidPTID PTIDFromFile 11 “0”