Coldfusion ListToArray and using "==" as a delimiter
coldfusion, coldfusion-9
Solution
This is expected behaviour. As described in the docs, ListToArray uses single-character delimiters (by default).
One solution is to use split:
Temp.split('==')
(This is making use of the underlying Java string.split method, which splits a string at every match of a specified regex, and works on all Java-based CFML engines, though produces a Java String Array - which can't be directly manipulated with CF's ArrayAppend and related functions, unless it is first converted. ).
Since you're on CF9, you can also use the new multi-char delimiter flag, by setting the fourth argument to true:
ListToArray(Temp,'==',false,true)
Problem
The code: ``` <cfset LOCAL.temp = 'something==a descript >= ive value' /> <cfdump var="#ListToArray(LOCAL.temp, '==')#" /> ``` What I expect is an array with two indices what I get is an array with three indices, CF is also splitting at the single equals sign. Is anyone else experiencing this behavior or can explain what is going on?