Chapter 5. Expanding String Functionality Using Lists
In this chapter, we will cover the following topics:
Creating a list
Joining two lists
Joining list elements
Appending list elements
Assigning list elements to variables
Retrieving an element from a list
Inserting elements into a list
Determining the number of elements
Getting a list element
Repeating elements
Replacing elements
Reversing elements
Searching a list
Editing a list
Sorting a list
Splitting a string into a list
Introduction
Now that we have a firm grasp on the string type, let's look at the Tcl command list
. As you might have discerned from the command name, this command is used to create and manage lists of information. While the various string handling commands allow for the creation of a string containing anything from a single character to larger text files, the list allows you to create, manipulate, and utilize a list of arguments in the same manner as a shopping list. In Tcl, each of the separate items in a list are referred to as elements...