Somone posted the following question on one of the lists I belong to...
"I have a string of IDs, like so: 3 91 64 37, but I'm not sure how to extract the values since the list doesn't have commas."
Don't forget that all list functions, even the cfloop tag, allow you to specify which delimiter to use when parsing the list.
In her case, all she needed to do was specify the space character as a delimiter.
Archived Comments
All of the list functions should allow you to specify the delimiter. In this case, its a space. By default it is a comma, so when you run the commands to extract, there should be a way to specify the delimiter. Check your documentation for CF.
I'm a bit confused - isn't this what I said in my post?
Try the following block of code:
<cfset ID = "3 91 64 37">
<cfloop index="counter" list="#ID#" delimiters=" ">
<cfoutput>Item = #counter#<br></cfoutput>
</cfloop>
The output should be:
Item = 3
Item = 91
Item = 64
Item = 37
All of the list functions appear to allow an optional delimiters = " " modifier
Dreamweaver shows the following for delimeters
'delimiters A string or a variable that contains one. Character(s) that separate list elements. Default: comma.
If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter. '
Ok, I'm really getting confused. Now that I mind, but did my post suggest that I did _not_ know what I was talking about? I said in the main post that all list funcs support optional delimiters, yet two people have posted this same fact. Maybe I wrote it wrong...