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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with replacenocase function

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm trying to filter some output, to convert these following characters into their numberic values.. please ignore the spaces here after the & symbols.. had to do that to get it to display correctly in this forum..

& #34; = "
& #39; = '
& amp; = &
& #40; = (
& #41; = )
& #91; = [
& #93; = ]
& #42; = *
& #47; = /
& #92; = & #43; = +
& #61; = =
& #63; = ?
& #37; = %
& #64; = @
& #35; = #
& #33; = !
& #44; = ,
& #46; = .
& #45; = -

Can someone help me modify the following line of code (which does something similar) to do this please? Hope you don't think I'm being lazy, its just not my day!

<cfset variables.Artist = rereplacenocase(rereplacenocase(top1.Artist, chr(34), chr(92) & chr(34), 'ALL'), &quot;'&quot;, &quot;\'&quot;, 'ALL')>

Looking forward to your repsonse. Thanks.
 
Does it NEED to be ReplaceNoCase?

Something like this:
Code:
<CFSET Variables.Artist = ReplaceList (Top1.Artist, &quot;#chr(34)#, #chr(39)#, &, (, ), [, ], *, /, \, +, =, ?, %, @, #chr(35)#, !, #chr(44)#, ., -&quot;, &quot;& #34;, & #39;, & amp;, & #40;, & #41;, & #91;, & #93;, & #42;, & #47;, & #92;, & #43;, & #61;, & #63;, & #37;, & #64;, & #35;, & #33;, & #44;, & #46;, & #45;&quot;)>
should work just as well... (I replaced some characters with their chr() equivalents to avoid parsing problems. You may want to replace the rest of them the same way) DarkMan
 
You could loop through it and using regular expression pick out only replace punctuation with the appropriate ASCII character:

<CFSET vString = &quot;This is a test !@##$%^&*()_-+={}[]\|:;'&quot;&quot;... done!&quot;>
<CFSET vString2 = &quot;&quot;>
<CFLOOP FROM=&quot;1&quot; TO=&quot;#Len(vString)#&quot; INDEX=&quot;i&quot;>
<CFSET vChar = Mid(vString,i,1)>
<CFSET vString2 = vString2 & ReReplace(vChar,&quot;[[:punct:]]&quot;,&quot;&###Asc(vChar)#;&quot;)>
</CFLOOP>
<CFOUTPUT>#VARIABLES.vString2#</CFOUTPUT>
- tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top