The STRTRIM function removes leading and/or trailing blank from the input String.
Converting variables to string type often results in undesirable leading blanks. For example, the following command converts the integer 56 to string type:
C = STRING(56)
Entering the command:
C STRING = ' 56'
which shows that there are six leading spaces before the characters 5 and 6. To remove these leading blanks, enter the command:
C = STRTRIM(C, 1)
To confirm that the blanks were removed, enter:
C STRING = '56'
Result = STRTRIM( String [, Flag] )
Returns a copy of string with the specified blank spaces removed.
The string to have leading and/or trailing blanks removed. If this argument is not a string, it is converted using IDL’s default formatting rules. If it is an array, the result is an array with the same structure where each element contains a trimmed copy of the corresponding element of String.
A value that controls the action of STRTRIM. If Flag is zero or not present, trailing blanks are removed. Leading blanks are removed if it is equal to 1. Both are removed if it is equal to 2.
This page has no user notes yet. Be the first one!