Solved

Replacing #

Posted on 2003-11-13
3
294 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
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Column Spacing 3 108
How to fix Redundant Hostnames notification from google analytic? 5 54
Two wordpress questions 3 75
htaccess block all countries but the US 4 33
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

679 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