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

Guide to TCL scripting for Eggdrop 1.6


[ Previous ] [ Index ] [ Next ]


9.2 Retrieving multiple characters from a string

This command works in exactly the same way as the lrange command, only the command is a bit different. To retrieve multiple characters from a string we use the command string range.
The syntax of a string range command is string range <string> <start number> <end number>.

The <string> is the string from which the characters must be retrieved.
This can be anything from a string as in variable to a command.

The <start number> is the number from which character you want to start cutting, where 0 is again the first character 1 the second character and so on.

The <end number> is the number up until which character you want to cut, where 0 is the first character and so on like in the above commands.
Here you can use "end" aswell to designate that there must be cut until the end of the string.

The string range command outputs a string that consists of the cut text.
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 range "test {foo bar} temp" 5 8 would return "{foo" and not "foo ".

[ Previous ] [ Index ] [ Next ]


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