Trim Command
Obsolete
This command is replaced by the Trim function.
Purpose
To remove leading and trailing spaces from a value and move the result to a variable.
Syntax
trim
value
to
variable
What It Does
The trim command removes leading and trailing blanks from the contents of value and places the result in variable. Blanks include spaces and any other characters (formfeed, linefeed, tab) designated in the Configuration as "white space." The trim command does not remove spaces in value that are surrounded by non-space characters.
string long short
move " 4 leading, 3 trailing " to long
trim long to short
In this example, the value of the string variable long has four leading spaces and three trailing spaces. The value of short after the trim command would be "4 leading, 3 trailing," with no leading or trailing spaces.
When you move a value from a window to another variable, trailing spaces are automatically stripped. Thus, the statement:
trim account.3 to string_var
would make sense only if you had reason to believe account.3 contained leading spaces, and you wished them removed.
The same reasoning applies to moving a value from another value to a window.
When you move a value from a field to another variable, trailing spaces are always included to the full specified length of the field. Therefore, where trailing spaces are not desired, the following command would be effective:
trim blessings.type to string_var
When you move a value to a field from another variable, using trim would make sense only if you desired to strip leading spaces.
Notes
-
You may trim
valueback to itself, unless it is a constant. Doing so permanently changesvalue, while trimming tovariablepreservesvaluein its original form. -
The suppress print format option removes trailing spaces from window output, while
trimremoves them from in-memory variables. -
The
padcommand adds trailing spaces to or removes them from the contents of variables to make them a specified total length.