cffaq.com


Hosted and maintained by Ben Forta. Designed by Trilemetry.
Language:
    © 2002-2007 Ben Forta. All Rights Reserved  
<Home> <FAQ> <Question> <About>

Question

When using comma delimited ColdFusion lists, why are empty elements ignored?
ColdFusion lists are not CSV comma-delimited lists and do not behave as CSV lists do. ColdFusion ignores empty list elements, so ListLen("a,b,,d,e") will return 4 (not 5), and ListGetAt("a,b,,d,e", 5) will throw an error. To convert a ColdFusion list to a CSV list, use Replace() and replace all ",," (comma comma) with ", ," (comma space comma) - a space is a valid list member value and ColdFusion will not ignore it.

Comments

Prosper (09-Aug-04)
Well the replace method would do the job but if you test for empty elements and put a number or an empty string, this also would work in eliminating those errors thrown.
Prosper (09-Aug-04)
Well the replace method would do the job but if you test for empty elements and put a number or an empty string, this also would work in eliminating those errors thrown.

Add Your Comments

Your Name:
Your E-Mail:
Comment:
Verification: Copy the text on the left:

<submit question>