The string Command
The string command is really a collection of operations you can perform on strings. The following example calculates the length of the value of a variable.
set name "Brent Welch" string length $name => 11
The first argument to string determines the operation. You can ask string for valid operations by giving it a bad one:
string junk => bad option "junk": should be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart
This trick of feeding a Tcl command bad arguments to find out its usage is common across many commands. Table 4-1 summarizes the string command
|string bytelength ...|