2014-04-15

TCL, string, worldstart & worldend 字串處理/取出想要的範圍

*字串處理, 找尋單字的開頭和結尾
syntax]:
  • string  wordstart  string1  charIndex
  • string wordend string1 charIndex
example]:
     set s1 "Tcl is a powerful programming language."
     set idx1 [string wordstart $s1 12]    #<第12個字元是落在 powerful>
     set idx2 [string wordend $s1 22]     #<第22個字元是落在 programming>
     puts [string range $s1 $idx1 $idx2]

output]:
     powerful programming

沒有留言:

張貼留言