Solved

how do escape a comma in a comma-delimited list

Posted on 2001-07-11
3
1,661 Views
Last Modified: 2013-12-24
I want to create a comma delimited list that contains a comma as one of the elements. How do I do this?
0
Comment
Question by:davelowndes
[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 Comments
 
LVL 4

Accepted Solution

by:
CF_Spike earned 100 total points
ID: 6273070
You can't.

To ColdFusion that will appear as 3 empty list elements. ColdFusion always ignores empty list elements. What you could do is create a list which uses something other than commas as delimeters.

Spike
0
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 6273665
I think CF_Spike's answer would be best, but if your stuck on using commas for some reason then when you create your list you could use a replacement flag for the value and replace it later in you code.

For example:

<cfset TheList="value1,value2,@Comma@,value4">

<cfloop list="#TheList#" index="i">
     <cfset StringItem = #Replace(i, "@Comma@", ",", "ALL")#>
     <cfoutput>#StringItem#</cfoutput>
</cfloop>
0
 
LVL 6

Expert Comment

by:dash420
ID: 6285743
Hi

u can put all data inside as test so put chr(34) before and after text while building of text.

chr(34) for "
chr(44) for ,

<cfset textstr = "#textstr#" & Chr(34) & "#product_name#" & Chr(34) & "#Chr(44)#">
0

Featured Post

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

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

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…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

623 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