Skip to main content
Inspiring
October 30, 2013
解決済み

How to do a replace on a sting witch contains an ASCII Char

  • October 30, 2013
  • 返信数 1.
  • 485 ビュー

Hi All,

I have a string named 'EMAIL_BODY' which contains the following text 'Blah blah &#39 blah blah'  What I want to do is replace &#39 with '

How am I able to do this? as I think I need to escapse the & and # ?

Many thanks,

George

    このトピックへの返信は締め切られました。
    解決に役立った回答 duncancumming

    Well if you're using the # in CFML you'll most likely need to escape references to it by using ## instead.

    <cfset EMAIL_BODY = "Blah blah &##39 blah blah">

    <cfset newBODY = replace(EMAIL_BODY, "&##39", "&##39;", "ALL")>

    <cfdump var="#variables#">

    返信数 1

    duncancumming解決!
    Participating Frequently
    October 30, 2013

    Well if you're using the # in CFML you'll most likely need to escape references to it by using ## instead.

    <cfset EMAIL_BODY = "Blah blah &##39 blah blah">

    <cfset newBODY = replace(EMAIL_BODY, "&##39", "&##39;", "ALL")>

    <cfdump var="#variables#">