egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delete some characters

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Tue Jun 13, 2006 10:57 am    Post subject: Delete some characters Reply with quote

Hello!
I have a script that stores some names in a textfile. Is it possible that special characters will be deleted before it is stored in the file?
For example my bot should save this name: "-{SFR}-Nick" but it should delete the "{" and "}" so that in the textfile there is only "-SFR-Nick".
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Jun 13, 2006 11:48 am    Post subject: Reply with quote

Code:
set nick [string map {\{ "" \} ""} $nick]

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Thu Jun 15, 2006 10:34 am    Post subject: Reply with quote

OK, thank you, it works, but there is a problem. If there are numbers in the name, my bot does not delete the "{" and the "}". For example: if the nick is "-{SFR}-Nick123", my bot should save this nick in this way: "-SFR-Nick123", but it does not delete the "{" and the "}". This problem only appears if there are numbers in the name. Can anyone help me?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Jun 15, 2006 12:31 pm    Post subject: Reply with quote

Quote:
Tclsh8.4:
% set foo -{SFR}-Nick123
-{SFR}-Nick123
% set foo [string map {\{ "" \} ""} $foo]
-SFR-Nick123
%

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
darton
Op


Joined: 21 Jan 2006
Posts: 155

PostPosted: Thu Jun 15, 2006 2:01 pm    Post subject: Reply with quote

OK, I made a mistake. In the nick I used there were other escape characters like "[" and "]". I deleted them with string map, too, because otherwise the "{" and the "}" would not be deleted.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber