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:
HELP, C
IDL prints:
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:
HELP, C
IDL prints:
C STRING = '56'