文章目录
一、字符串
1.字符串的表示
- 只有一个字是,不需要包含双括号
set myVariable hello - 当表示多个字符串,可以使用双引号或大括号
set myVariable “hello world”
set myVariable {hello world}
1.字符串命令
1.compare string1 string2
比较字符string1和string2字典顺序。如果相等返回0,如果string1在string2出现之前返回-1,否则返回1。
#!/usr/bin/tclsh
set s1 "Hello"
set s2 "World"
set s3 "World"
puts