SUNiNET - Your Eggdrop & TCL resources site
[ Home Eggdrop TCL Links About ]

Guide to TCL scripting for Eggdrop 1.6

[ Previous ] [ Index ] [ Next ]

9.5 Changing the string case

A lot of things in TCL are case sensitive.
For example in most cases "FOO" would not be the same as "foo", so in some cases it might be wise to first convert something to lower case or upper case alone before matching it against something. This can be done with string tolower and string toupper.
The syntax of a string <tolower/toupper> command is string <tolower/toupper> <string>.

The <tolower/toupper> is to which you want to convert the case, tolower will convert your string to lower case and toupper will convert it to upper case.

The <string> is the string what you want to convert.
This can be anything from a variable string to a command that outputs a string.

The string <tolower/toupper> command outputs a string in which all the characters are converted to lower or upper case.
If you were to input a list which contains an object that is defined with braces, the braces will also be regarded as characters in the string and not as items to designate a start and top of an object.
For example, string tolower "test {foo BAR} temp" would return "test {foo bar} temp" and not "test foo bar temp".

[ Previous ] [ Index ] [ Next ]

Design & Graphics by Shawn Borton
Copyright © 2000-2005 Marijn van Zon