[thelist] &

.jeff jeff at members.evolt.org
Fri Sep 27 06:05:01 CDT 2002


stevenson,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Stevenson Ngila
>
> Thank u very much. What if you have 2 characters to be
> replaced. i.e. if the value contains both '&' and '<'
> How do you go about it?
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

well, logic would dictate that you'd apply two calls to the Replace() function to accomplish this task.  you can either do it nested or you can perform a single assignment for each one.

<cfset my_new_string = Replace(your_db_column_name, "&", "&amp;", "ALL")><cfset my_new_string = Replace(my_new_string, "<", "&lt;", "ALL")>

alternatively, you could also use the ReplaceList() function:

<cfset my_new_string = ReplaceList(your_db_column_name, "&,<", "&amp;,&lt;")>

always apply the & replacement first.

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list