idl number to string

来源:互联网 发布:js树形菜单 编辑:程序博客网 时间:2024/05/22 12:41

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'
0 0