string 命令合集
示例: compare
Vivado% string compare "abc" "abc"
0
Vivado% string compare "abc" "Abc"
1
equal
Vivado% string equal "abc" "abcd"
0
index
Vivado% set str "hello world"
hello world
Vivado% string index $str 4
o
range
Vivado% set str "hello world"
hello world
Vivado% string range $str 0 4
hello
replace
Vivado% set str "hello world"
hello world
Vivado% string replace $str 0 4 HELLO
HELLO world
length,repeat,reverse,toupper
Vivado% set str "hello world"
hello world
Vivado% string length $str
11
Vivado% string repeat $str 2
hello worldhello world
Vivado% string reverse $str
dlrow olleh
Vivado% string toupper $str
HELLO WORLD
first,last
Vivado% set str1 "hello"
hello
Vivado% set str2 "hello world,hello everyone"
hello world,hello everyone
Vivado% string first $str1 $str2
0
Vivado% string last $str1 $str2
12
trim
Vivado% string trim " hello " " "
hello
Vivado% string trimleft " hello world" " "
hello world
Vivado% string trimright "hello world " " "
hello world
etc