In the process of remote sensing image processing, the problem of storing data naming is always encountered, and the effective use of IDL string function can achieve the desired effect.
1.file_basename (): Return file name
File = ' F:\data\myfile.img ' title = file_basename (file, '. img ') print,title >myfile
2.file_dirname (): Returns the folder name
File = ' F:\data\myfile.img ' title = file_dirname (file) print,title >f:\data
3.STRCMP (): Compare strings for the same
Print, STRCMP (' Moose ', ' Moo ', 3,/fold_case) >1; determine whether the first three of the two strings match, return, 1, or 0 plus the keyword/fold_case case-insensitive
4.STRLEN (): Calculate string length
Print,strlen (' ABCD ') >4
5.STRTRIM (): Remove the space in the string, n=0, means to remove the trailing space, n=1 remove the front space, n=2 front and rear of the fort space are removed
Print,strtrim (' abc ', 0) >abc
6.STRMID (): From the N1 position of the string, remove the N2 characters of the substring, if omitted N2, then read to the end of the string,/reverse_offset refers to from the tail count
Print,strmid ' ABCD ', 0,2) >ab
7.
IDL commonly used string processing functions