Solved

Replacing #

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to insert an Iframe into 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 : Open Page or Post…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now