strput,‘000’ ,‘26’,1 输出 026 ;用b从第2个位置来代替c
7.strupcase和strlowcase
将字符串中的所有大写(小写)字母换成小写(大写)字符,其他非字母字符不转换
8.strcompress(字符串,/remove_all)
去除单词间多于一个的空格,/remove_all会删除所有空格
如 print,strcompress('i love you') 输出i love you
9.strcmp
比较字符串是否相同
10.strpos (字符串1,字符串2)
检测字符串2是否在字符串1中出现,若出现返回出现的位置,否则返回-1
此外还有systime是返回当前的系统日期
10.strsplit
根据设定的界定符号来划分字符串 比如
print,strsplit('C:\\DocumentsandSettings\\Administrator\\can_tmr.img','.',/extract) C:\\DocumentsandSettings\\Administrator\\can_tmr img
这里它是将'C:\\DocumentsandSettings\\Administrator\\can_tmr.img'利用.分成了两部分
C:\\DocumentsandSettings\\Administrator\\can_tmr和img
但是如果没有界定符的话,默认的界定符为空格或者tab
如 print,strsplit('C:\\Documents and Settings\\Administrator\\can_tmr.img',/extract) C:\\Documents and Settings\\Administrator\\can_tmr.img
这里其实包括了三个字符串C:\\Documents、and以及Settings\\Administrator\\can_tmr.img
最后到底分成了几个字符串,可以设置关键字count来计算
如print,strsplit('C:\\Documents and Settings\\Administrator\\can_tmr.img',count=n,/extract),n C:\\Documents and Settings\\Administrator\\can_tmr.img 3
如果次命令没有设置/extract关键字,那么输出的结果是分割符号所处的位置
如print,strsplit('C:\\Documents and Settings\\Administrator\\can_tmr.img',count=n),n 0 13 17 3
4.IDL求解对数
1、以10为底的对数叫常用对数,简记为lgN。在IDL中使用ALOG10()函数。
2、以无理数e(e=2.718 28…)为底的对数叫做自然对数,简记为lnN。在IDL中使用ALOG()函数。
3、对于任意数为底的对数,则利用相关性质求解 log(a)(N)=loglog(b)(N)/loglog(b)(a)
例子:求 log(2)(64)
IDL>print, ALOG10(64)/ ALOG10(2) 或者:IDL>print, ALOG (64)/ ALOG (2)