I was parsing through a csv file today and having issues with empty values. The data I'm receiving is in a format the 3rd party cannot update, so my data looked something like this

1,,abc,32,,gef

Dumping the list provides the expected list, but looping through the list it skips over values

view plain print about
1<cfoutput>
2    <cfloop list="#list1#" index="i">
3        #i#<br>
4    </cfloop>
5</cfoutput>

produces

view plain print about
11
2abc
332
4gef

After googling this for a bit I gave up and asked my brother. He told me to use the 'includeemptyfields' attribute in listtoarray(). I knew I could turn a list into an array, but I wasn't aware of the third attribute until today, the default is obviously false, so blank values were never included.

The code below produces the desired output. Notice I am now looping through an array instead of a list.

view plain print about
1<cfset newlist = listToArray(list1,',',true) />
2<cfoutput>
3    <cfloop array="#newlist#" index="i">
4        #i#<br>
5    </cfloop>
6</cfoutput>
7
81
9
10abc
1132
12
13gef