TrimWhitespace
All validation programs
Removes leading and trailing whitespace characters (spaces and tabs) from a value and replaces any sequences of two or more whitespace characters within the value with a single occurrence.
Format of Parameters
InputValue OutputVar Options
Where:
InputValue
|
The value to be trimmed. This can be a constant in double quotes, an internal variable name (Current_Element, Current_Date, etc.), or an external variable name. |
OutputVar
|
An external variable name where the result is to be stored. |
Option
|
The character string containing one or more of the following characters (these options can be combined): L Remove any leading whitespace characters T Remove any trailing whitespace characters M Replace any strings of two or more whitespace characters within InputValue with a single space If Options is not specified then LTM is assumed. |
Examples
In the following examples, ‘·’ represents a space and ‘»’ represents a tab.
Example 1
This example causes the string ‘Test·Value’ to be stored into variable RESULTVAR. Because no Option was specified, ‘LTM’ is assumed so leading and trailing whitespace characters are removed and duplicate whitespace sequences within the string are replaced by a single space.
Example 2
This example causes the string ‘Post·Office·Box·1234’ to be stored into variable TRIMMEDADDR1. The ‘space tab space’ sequence is handled as a string of three whitespace characters and is replaced by a single space. (ADDR1 = “»Post·»·Office··Box··1234»”)
Examples 3
This example causes the string ‘Post·»·Office··Box··1234’ to be stored into variable TRIMMEDADDR1. Because Option LT was used, leading and trailing whitespace characters are removed. (ADDR1 = “»Post·»·Office··Box··1234»”)