BlueDragon Blog
Here you'll find tips and information about making the most of BlueDragon, which offers several compelling implementation alternatives for your CFML applications. This blog was created originally by Charlie Arehart, who was New Atlanta CTO from 2003-2006.,He has since moved on to become an independent consultant but continues to answer comments raised in existing blog entries. BlueDragon continues, and you should look to the newer BlueDragon blog, from New Atlanta president, Vince Bonfanti, for more updated information.

BlueDragon Advantage - ListToArray

posted Thursday, 23 December 2004

Continuing the list of technical advantages BlueDragon offers (it's so much more than just another way to run CFML), sometimes it's the little things. Just the other day, someone on a list was complaining about how the ListToArray function would skip empty list items (as CFML list functions generally do).

We recognized a long time ago that in the case of this list function especially, it might be important sometimes to honor that empty element in creating the array, so we added a new third argument, a boolean, which determines whether to include empty list elements in the resulting array. The default is no, which causes it to operate consistently with ColdFusion. Consider the following:

<cfset list = "1,2,,3">
<cfdump var="#listToArray(list,",")#">

Both ColdFusion and BlueDragon would return an array of 3 elements, even though there are 4 items in the list, the third of which is empty.

Use the newly available third argument to change this behavior:

<cfset list = "1,2,,3">
<cfdump var="#listToArray(list,",","yes")#">

This creates instead an array of 4 elements, with the third being empty.

Again, sometimes it's the little things.




1. a reader left...
Thursday, 23 December 2004 1:37 pm

You know what we really need is an arrayfind function. For an example of why see http://www.ryanguill.com/blog/index.cfm?mode=entry&entry=CF41E37B-4 0CA-6D1C-8AAA5C639479334D especially in the comments.

Ryan Guill [ryanguill@gmail.com]