Solved

how do escape a comma in a comma-delimited list

Posted on 2001-07-11
3
1,563 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
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:SBennett
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

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…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

20 Experts available now in Live!

Get 1:1 Help Now