Solved

Replacing #

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Apache SSL and mod_rewrite not working 8 247
Systems talking to each other 5 150
WCAG (Web Content Accessibility Guidelines) levels 3 145
ReadyAPI 1.9.0 2 46
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 …
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…

752 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