-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Tcl/Tk 8.5 Programming Cookbook
In any of the programs, string comparison is critical for many reasons. To perform string comparison, Tcl provides two keywords for use with the string command—compare and equal. The syntax for the first keyword compare is as follows:
string compare nocase length string1 string2
When invoked with the compare keyword, the string command performs a character-by-character comparison of the strings passed in string1 and string2.
The string command accepts two switches as mentioned here:
-nocase
Strings are compared in a case-insensitive manner
-length
Instructs the interpreter to perform the comparison only on the first length characters
To complete the following example, we will need to create a Tcl script file in your working directory. Open the text editor of your choice and follow the given instructions.
In the following example, we will create a Tcl script to accept a string value to compare against a static value. In this method, you can see...
Change the font size
Change margin width
Change background colour