Name
string
- string
option arg
... Perform string operations on one or more strings, based on the value of
option
. String indices start at 0.- string compare
string1 string2
Compare strings lexicographically. Return −1 if
string1
is less thanstring2
, 0 if equal, or 1 if greater.- string first
string1 string2
Return the index of the first occurrence of
string1
instring2
, or −1 if no match.- string index
string charIndex
Return the character in
string
that has indexcharIndex
. Return empty string ifcharIndex
is out of range.- string last
string1 string2
Return the index of the last occurrence of
string1
instring2
, or −1 if no match.- string length
string
Return the length of
string
in characters.- string match
pattern string
Return 1 if
string
matches glob patternpattern
; otherwise, return 0.- string range
string first last
Return substring of
string
consisting of characters from indexfirst
throughlast. Last
can be the string “end”.- string tolower
string
Return
string
converted to lowercase.- string toupper
string
Return
string
converted to uppercase.- string trim
string [chars
] Return
string
with leading and trailing characters from the setchars
removed (default is whitespace characters).- string trimleft
string [chars
] Return
string
with leading characters from the setchars
removed (default is whitespace characters).- string trimright
string [chars
] Return
string
with trailing characters from the setchars
removed (default is whitespace characters).- string wordend
string index
Return index of first character after ...
Get Tcl/Tk in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.