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.

string map

Old posts that have not been replied to for several years.
Locked
N
Nexus6
Op
Posts: 114
Joined: Mon Sep 02, 2002 4:41 am
Location: Tuchola, Poland

string map

Post by Nexus6 »

Lo,
I've used string map in a few scripts without probs, in one script I wanna replace { with ""

Code: Select all

set example2 [string map {"}" ""} $example1]
and it doesn't work (Tcl error [sb]: extra characters after close-brace) neither does

Code: Select all

set example2 [string map {} ""} $example1]
but it was obvious ;)

I wonder how can be replacing { bracket with string map done
Thanks in advance for help
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

You mean like:

Code: Select all

set string hehe\{\{haha
puts "STRING: $string"
puts "MAPPED: [string map { \{ new } $string]"
N
Nexus6
Op
Posts: 114
Joined: Mon Sep 02, 2002 4:41 am
Location: Tuchola, Poland

Post by Nexus6 »

yay it works! Thanks a lot egghead :)
Locked