-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Tcl/Tk 8.5 Programming Cookbook
It is not uncommon to cut a string into its constituent parts. This allows the data to be stored in-line, without comma or space separation, thereby, minimizing the impact on the disk storage. To assist us in this, and other instances where we need to extract a range of characters from a string, Tcl has provided the range keyword.
The syntax of the string command is as follows:
string range string first last
When invoked with the range keyword, the string command will return all characters inclusive between those specified in the first and last location.
In the following example we will locate a range of characters contained within a string. Return values from the commands are provided for clarity. Enter the following command:
% string range abcdefg 2 4 cde
As you can see, Tcl has returned the characters "cde", based on the index values passed. The string command returns a range of consecutive characters from the string...
Change the font size
Change margin width
Change background colour