1 Reply Latest reply on May 8, 2006 11:17 AM by cutie369

    Having problems with a replace function

    cutie369
      Can one of you guys please tell me what I am doing wrong here. I have 3 sets of characters that word produces which I must replace in my strings before they enter the DB. Here are the characters.

      — Remove this dash with  - 

      ’ Remove this apostrophe with '

      “ Remove this left double quote with "

      ” Remove this right double quote with "

      My Problem is that the replace() function only gets the first occurance and replaces that. Not all occurances. How can I make it replace all occurances? Here is my code.

        • 1. Re: Having problems with a replace function
          cutie369 Level 1
          I figured it out. I was missing the ALL parameter.

          <cfscript>
          form.test = replace(#form.test#, "&mdash;", " - ", "ALL");
          form.test = replace(#form.test#, "&rsquo;", "'", "ALL");
          form.test = replace(#form.test#, "&ldquo;", """", "ALL");
          form.test = replace(#form.test#, "&rdquo;", """", "ALL");
          </cfscript>