This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

split command

Old posts that have not been replied to for several years.
Locked
N
Nada_Surf

Post by Nada_Surf »

when using the split command to create a list from a string, can the program get confused with characters within a string variable...?

ie

set string1 ""word1 word2"

set list [split $string1]

theoretically the list should have elements: "word1 word2

or does the " mess up the splitting?
User avatar
Souperman
Halfop
Posts: 69
Joined: Sat Feb 02, 2002 8:00 pm
Location: Cape Town, South Africa
Contact:

Post by Souperman »

You'd need to escape the " with a if it's to be part of the string. So...

set foo ""word1 word2"
set bar [split $foo]

$bar is now a list with elements {"word1} and {word2}
Locked