Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Search and replace ampersand

Guest
Apr 05, 2011 Apr 05, 2011

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?

562
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 05, 2011 Apr 05, 2011

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 05, 2011 Apr 05, 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")"?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 05, 2011 Apr 05, 2011
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources