Here is one of those finicky nuances that might surprise you about Coldfusion. Many languages have list functions or something similar to list functions. In many of these languages there is some version of split or splitf that allows you to specify any string as a delimiter regardless of length. This might lead you to believe that you can use a multi-character string as a delimiter in list functions in Coldfusion. Not only is this not the case but the way delimiters behave can cause you to believe it is working when in fact it is not. Let me explain.
Let's start with some sample code. Consider this simple little list parsing scriptlet:
<cfset itemlist = 'joe3bob3harry3mary3Ann4jo-bob'/>
<cfloop list="#itemlist#" index="x" delimiters="3">
<cfoutput>#x#<br></cfoutput>
</cfloop>
If you run this code it will display a list that looks like this:
joe
bob
harry
mary
Ann4jo-bob
The 3 is the delimiter and the list is exactly what you think it should be. So far there is nothing surprising. But now let's attempt a multi-character delimiter. Let's use "3-4" as our delimiter in the following example.
<cfset itemlist = 'joe3-4bob3-4harry3-4mary3-4Ann4jo-bob'/>
<cfloop list="#itemlist#" index="x" delimiters="3-4">
<cfoutput>#x#<br></cfoutput>
</cfloop>
You would expect this to show:
joe
bob
harry
mary
Ann4jo-bob
But instead you get a very peculiar result. It will look like this:
joe
bob
harry
mary
Ann
jo
bob
What in the ham sandwich is going on here? As it happens, Coldfusion will look for any one of the three characters as a delimiter. So any time a 3, 4 or a dash (-) shows up in the string, it is treated as a delimiter and a list item is identified. This will fool you because your compound delimiter will often look like it is working correctly. Why? Because the first letter of your delimiter will always trigger a list item. If your characters are semi-unique it is often going to look right. But you will end up with a hard-to find bug that only rears its head when your tested code starts handling regular data.
Please note, the code above was tested on Coldfusion 7. Coldfusion 8 introduces lots of additional functionality - looping over a file a line at a time for example - that may change this behavior. Oddly, I have never actually seen this list nuance blogged or discussed anywhere, but that could be an anomaly. In any case I will try and test it on CF 8 if I have the time and post an update.