Visit the ColdFusionProNews Directory
Beginners
Installation, Coding Techniques, Data Structures...
CF Powered Sites
Stores, Directories, Universities...
Developers
Developers, Designers, Experts...
E-commerce
Shoes, Food, Music...
Education
Books, Online Resource, Languages...
Expert
LiveChat , CFX XMLParser , User Defined Function Library...
Hosting
Dedicated Servers, Virtual Server, Multi-user...
Intermediate
AutoResize , DataSource Encryption, Guestbook...

Submit your site for FREE

Implementing Railo Effectively As A Developer


By: Raymond Camden

During my presentation earlier this week, I brought up a few 'Gotchas' that ColdFusion developers may not be aware of.

Today I'm going to review some of these for those who couldn't make the presentation.

The first item that came up was during my discussion of ColdFusion lists.

The one thing I really see trip people up (and it tripped me up when I was building my first ColdFusion application - back in the dinosaur days) is the fact that list delimiters are only single characters - even if you pass multiple delimiters. So what do I mean? Consider this list:

<cfset monkeys = "King Kong__+__George, Bush__+__Clinton, Hillary__+__Super_Monkey">

Looking at this string you might think you could simply tell ColdFusion to use __+__ as a delimiter. Consider this loop:

<cfloop index="item" list="#monkeys#" delimiters="__+__">

Many developers think that ColdFusion will do this: "Ok, take my string, and consider the literal string __+__ as a delimiter." Instead, ColdFusion does this: "Ok, I'll use _ and + as delimiters."

What this means is that our loop will display:

King Kong
George, Bush
Clinton, Hillary
Super
Monkey

The _ inside of Super_Monkey was considered a delimiter and therefore was split up by ColdFusion.

In case you do want to split up a string by a set of characters, consider the split() UDF at CFLib.

Comments

About The Author

Raymond Camden, ray@camdenfamily.com
http://ray.camdenfamily.com

Raymond Camden is Vice President of Technology for roundpeg, Inc. A long time ColdFusion user, Raymond has worked on numerous ColdFusion books and is the creator of many of the most popular ColdFusion community web sites. He is an Adobe Community Expert, user group manager, and the proud father of three little bundles of joy.