-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Tcl/Tk 8.5 Programming Cookbook
The third keyword that Tcl provides to alter the case of a string is toupper. As its name implies, the toupper keyword returns a string set to all uppercase characters.
The syntax of the string command is as follows:
string toupper string first last
The string command will convert all lowercase characters in a string to uppercase. If an optional index value is passed in the first location, the conversion will commence at that location. If an index value is passed in the last location, this will designate the location at which the conversion will stop.
In the following example, we will convert a string that contains only lowercase characters to uppercase. Return values from the commands are provided for clarity. Enter the following command:
% string toupper "now is the time" NOW IS THE TIME
Tcl returns the entire string converted to its uppercase value.
Change the font size
Change margin width
Change background colour