Searching a list
As with any data contained within a program, it is the ability to locate and use that data that makes the program usable. To accomplish this, Tcl provides not only a command, but also a full complement of option flags to tailor the search. The lsearch
command allows us to search a list to determine if it contains a particular element. Before we explore the syntax, we will first need to understand the options. The options are as follows:
Type of option |
Option name |
Interpretation |
---|---|---|
Matching style options |
|
The pattern is a literal string that is compared against each element. |
|
The pattern is a glob-style pattern that is matched against each element in the same manner, as a string match. | |
|
The pattern ... |
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.