Solved

Remove double quote from each string in list

Posted on 2006-11-13
5
2,406 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
[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
  • 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Web server load balancing technologies and methods 3 106
ip / url redirect 13 76
Best practices for sharing large amounts of data 9 118
How to use 2 separate DNS names. 5 56
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.
What You Need to Know when Searching for a Webhost Provider
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

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