| View previous topic :: View next topic |
| Author |
Message |
soulfly Voice
Joined: 25 Apr 2006 Posts: 2
|
Posted: Tue Apr 25, 2006 11:59 pm Post subject: Replace $string1 with $string2 |
|
|
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 |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Wed Apr 26, 2006 1:48 am Post subject: |
|
|
| Code: | | regsub -all {\*} $value {%} value |
|
|
| Back to top |
|
 |
soulfly Voice
Joined: 25 Apr 2006 Posts: 2
|
Posted: Wed Apr 26, 2006 3:31 am Post subject: |
|
|
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 |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Wed Apr 26, 2006 4:43 am Post subject: |
|
|
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 |
|
 |
|