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 ...

Get Tcl/Tk 8.5 Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.