Solved

Remove double quote from each string in list

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

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 …
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

615 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