Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how do escape a comma in a comma-delimited list

Posted on 2001-07-11
3
Medium Priority
?
1,713 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 400 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

721 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