Solved

Remove double quote from each string in list

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Script 12 155
Problem to Eclipse 16 125
listing all functions in JavaScript 19 201
app server have enough resources... 2 41
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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