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 

Replace $string1 with $string2

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


Joined: 25 Apr 2006
Posts: 2

PostPosted: Tue Apr 25, 2006 11:59 pm    Post subject: Replace $string1 with $string2 Reply with quote

Hey guy's. I was searching here for the replacement function.
But I found nothing, or I was too stupid to mange the Search :X

My problem is very simple, I think.
I want to replace * with % in $value
I tried regsub -all but it didn't worked.

Thanky you for any help.

greetz soulfly
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Wed Apr 26, 2006 1:48 am    Post subject: Reply with quote

Code:
regsub -all {\*} $value {%} value
Back to top
View user's profile Send private message
soulfly
Voice


Joined: 25 Apr 2006
Posts: 2

PostPosted: Wed Apr 26, 2006 3:31 am    Post subject: Reply with quote

Oh thx, I already solved by problem.
I used string map
But can u tell me wich is faster?

I have several options.
Once it should replace * and ' ' (space) by a % (for the sql query)

And other time it sould
searchfor '(', ')', '-', '.', '_'
replacew '', '', ' ', ' ', ' '

They are sorted as above + below.
Thx in future for any help
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Wed Apr 26, 2006 4:43 am    Post subject: Reply with quote

depends on length of string and cacheablitlity of the whole script. I'd say string map is about twice as fast. As longer the string and as more seldom it gets called cached (precompiled) as bigger will be the difference.
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
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