Solved

how do escape a comma in a comma-delimited list

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

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

864 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