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

Guide to TCL scripting for Eggdrop 1.6


[ Previous ] [ Index ] [ Next ]


9.6 Converting lists into strings

You can convert a list into a string with the join command.
The syntax of a join command is join <list> [character].

The <list> is the list you want to convert into a string, which can be anything from a string containing a list or a command that outputs a list for example.

The [character] is the character that will be put between the former list objects in the new string.
If no character is provided a space is put between the objects.

The join command returns a string with all the objects in the <list> seperated by the [character].
Any braces that are in the <list> which are used to define the start and end of a object will not be included in the new string, only the objects are transformed into a string.

A small example: join [list "test" {foo bar} "temp"] would result in a string containing "test foo bar temp" or join [list "test" {foo bar} "temp"] . would result in "test.foo bar.temp" (notice  that the space in "foo bar" has NOT been replaced by a dot because the join command joins the objects of a list and not the words!).


[ Previous ] [ Index ] [ Next ]


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