Converting a string to lowercase

To prevent the case of a string from impacting your programs, Tcl has provided several keywords to manipulate the case of stored strings. The first of these is tolower. As its name implies, the tolower keyword returns a string with all characters in lowercase.

The syntax of the string command is as follows:

	string tolower string first last

The string command will convert all upper or title characters to their lowercase values and return the newly created string. If an optional index value is passed in the first location, the conversion will commence at that location. If an index value is passed in the last location, this will designate the location at which the conversion will stop.

How to do it…

In the following ...

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.