Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how do escape a comma in a comma-delimited list

Posted on 2001-07-11
3
Medium Priority
?
1,740 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 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

926 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