stringlength 返回字符串的长度 2 stringindex 返回字符串对应位置的字符 3 stringrange 返回字符串中一种范畴内的字符子串 例子:018_string.tcl setstringthisismyteststring putsThereare[stringlength$string]charactersin\$string\ puts[stringindex$string1]isthesecondcharacterin\$string\ ;#返回h puts\[string...
split命令语法:split string ?splitChars? 把字符串string按分隔符splitChars分成一个个单词,返回由这些单词组成的串。如果splitChars 是一个空字符{},string被按字符分开。如果splitChars没有给出,以空格为分隔符。例: % split how.are.you . how are you % split how are you how are you % split how ...
语法:split string ?splitChars? 把字符串string按分隔符splitChars分成一个个单词,返回由这些单词组成的串。如果splitChars 是一个空字符{},string被按字符分开。如果splitChars没有给出,以空格为分隔符。例: % split "how.are.you" . how are you % split "how are you" how are you % split "how are...
在string1种查找string2的定义次出现的位置。未找到返回-1。 string length string 返回字符串string的长度。 string match pattern string 判断string是否能匹配pattern。pattern是以shell文件名的 统配格式来给出。 string range string first last 返回字符串string中从first到last之间的内容。 string tolower string ...
join list joinChars split string splitChars foreach var list {proc body} foreach 命令将在控制结构一章介绍. 说明 创建一个列表 返回列表 list 中的第 index 个元素(element)值 计算列表 list 元素个数 返回指定范围内(从 index1 到 index2)的元素 将新元素追加到原来列表 list 后组成新的列表 将新元素...
In our program, we split and join strings. set langs "Tcl,Java,C,C#,Ruby,Falcon" This is a string we are going to split. There are several words separated by a comma character. The comma character is the character, by which we split the string. ...
split命令: 语法:split string ?splitChars? 把字符串 string按分隔符 splitChars分成一个个单词,返回由这些单词组成的串。如果 splitChars 是一个空字符{},string被按字符分开。如果splitChars没有给出,以空格为分隔符。例: % split "" . how are you % split "how are you" how are you % split "how...
TCL支持以下的反斜杠置换:BackslashSequenceReplacedByaAudiblealert(0 x7)bBackspace(0 x8)fFormfeed(0 xc)nNewline(0 xa)rCarriage 18、return(0 xd)tTab(0 x9)vVerticaltab(0 xb)dddOctalvaluegivenbyddd(one,two,orthreeds)xhhHexvaluegivenbyhh(anynumberofhs)newlinespaceAsinglespacecharacter.例如:...
tcl> string last abc xxxxxx-1 The 'string match' command uses the glob-style pattern matching like many UNIX shell commands do. === Glob-style syntax: *Matches any number of any character. ?Matches any single character. [ ]One of a set of characters...
List split命令语法:split string ?splitChars? 把字符串string按分隔符splitChars分成一个个单词,返回由这些单词组成的串。如果splitChars 是一个空字符,string被按字符分开。如果splitChars没有给出,以空格为分隔符。例: % split how.are.you . how are you % split how are you how are you % split how...