Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find *-/,;. and replace ????

Status
Not open for further replies.

Bramvg

IS-IT--Management
Jan 16, 2001
135
BE
Hi,

I'm trying to achieve something very simply, I thought.
But apparently it does not work.

I have a string like:

"The movie-trailer I've seen yesterday was: l.a. confidential"

Now, I would like to strip ALL the special signs out of this sentence, so it would be:

Chars to be replaced with a white space are: "-':."

So the result would be:
The movie trailer I ve seen yesterday was: l a confidential

But it does not work!?
It works fine if I only enter 1 char to replace.......

Any suggestions how to replace different signs?
tnx
bram





 
Hey Bram,

You could run your string through several replace() functions to strip out each character or this loop might work as well.

<cfset myString=&quot;The movie-trailer I've seen yesterday was: l.a. confidential&quot;>

<cfset newString=&quot;&quot;>
<cfloop list=#myString# index=&quot;x&quot; delimiters=&quot;-':.&quot;>
<cfset newString=&quot;#newString##x# &quot;>
</cfloop>

Let me know if you have trouble with it.
GJ
 
GJ,

Once again, many thanks GunJack!
I never thought on a cfloop, how silly of me!

bram
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top