Skip to main content
April 5, 2011
Question

Search and replace ampersand

  • April 5, 2011
  • 1 reply
  • 614 views

I have built a Coldfusion page which brings database info to the page. In the database the inputters have used ampersands (&) instead of 'and'. How can I search and replace using Coldfusion within the existing page?

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    April 5, 2011

    content = replace(content, " & ", " and ", "all")

    April 5, 2011

    I am a relative newcomer to Coldfusion so this might appear a silly question, where do I put this "content = replace(content, " & ", " and ", "all")"?

    Participating Frequently
    April 5, 2011

    OK, so assume you have data coming out of a database, say maybe the query

    is called "pageData" and the column is called "content".

    Instead of just doing this:

    #replace(pageData.content, " & ", " and ", "all")#</cfoutput