-
Book Overview & Buying
-
Table Of Contents
Tcl/Tk 8.5 Programming Cookbook
While the concat command is more than capable of merging lists and arguments into a single list, Tcl also provides the join command to expand the functionality. The join command will not only merge the arguments, but also allows insertion of a separation character into the returned string. Note that the variable provided must contain a list, set of lists, or standalone values. The syntax is as follows:
join list delimiter
In the following example, we will join the elements of a list and create a comma-delimited string. Return values from the commands are provided for clarity. Enter the following command:
% set input {John Mary Bill}
John Mary Bill
% join $input ", "
John, Mary, Bill
The join command returns the complete string created by joining all elements of the variable provided. If a delimiter is specified, it will create a delimited list, otherwise the string will be returned space delimited.
In the following example, we...
Change the font size
Change margin width
Change background colour