Solved

Replacing #

Posted on 2003-11-13
3
309 Views
Last Modified: 2013-12-24
string1 contains a value retrieved from a database table, this is "Don't and Won't" - where ' is the character code for an apostrophe.

I would like to replace the character code with an actual apostrophe

<cfset string2 = replace(string1,"&#039;","'">

So the result will be:

Don't and Won't

Trouble being that Coldfusion doesn't like the # in the replace()

Any ideas?
0
Comment
Question by:bbowman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Expert Comment

by:PE_CF_DEV
ID: 9739636
use ##
0
 
LVL 6

Accepted Solution

by:
PE_CF_DEV earned 50 total points
ID: 9739662
Doubling up the # sign is like using escapes in other languages. Same thing in SQL if youm want an apostrophie you do '', in coldfusion if you want to use a # sign you do ##..Ment to put this all in one post hit tabthen enter and poof it got submited :-))

So your code would be:

<cfset string2 = replace(string1,"&##039;","'">
0
 
LVL 1

Author Comment

by:bbowman
ID: 9740554
Yep, tried that and it didn't work.

Tried it again and it did?!

0

Featured Post

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question