Solved

Remove double quote from each string in list

Posted on 2006-11-13
5
2,402 Views
Last Modified: 2013-12-24
I have a comma-delimited list that have a double quote after each string such as peter", paul", mary"  How can I remove the double quote from each string, then recreate the list?
0
Comment
Question by:COwebmaster
  • 3
5 Comments
 
LVL 1

Expert Comment

by:coderWil
ID: 17933226
The code below assumes that 'xx' is your variable name that carries the value list.  for your code, change it to your variable name.

What it does:  It replaces all double-quote comma occurances with only a comma  and then it checks to see if there is a 'trailing' double quote and removes it completely.

<cfset xx = replace(xx, """,","""")>
<cfif right(xx, 1) = """">
  <cfset xx = left(xx, len(xx) - 1)>
</cfif>
0
 

Author Comment

by:COwebmaster
ID: 17933406
Ok, let me try that..
0
 

Author Comment

by:COwebmaster
ID: 17933518
Didn't work.  Again, what I have is already a comma delimited string:

peter", paul", mary"

I just need to remove the quotes at the end of each name so it's:

peter, paul, mary
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 17933530

 a list is just a string as well, this should work
 <cfset variables.mystring = replace(variables.mystring,'"','','all')>

 (note that the 2nd parameter is   '  "   '    (but without spaces)  
0
 

Author Comment

by:COwebmaster
ID: 17933614
Perfect, thanks!
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

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…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

759 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