In pure java you can also do this:
<Cfset
myList=CreateObject("java","java.util.Arrays").asList(list.split(","))>
Then you can do
myList.get(0), myList.get(5) ,myList.size();
-----Original Message-----
From: Katz, Dov B (IT)
Sent: Monday, March 07, 2005 7:19 AM
To: CF-Talk
Subject: RE: ColdFusion ignores empty list elements
How about this?
List=replace(list,",,",", ,","ALL");
If (list.endsWith(",")) list=list & " ";
Then do trim(listGetAt(list,X));
A bit hackish, but it'll work.
-dov
-----Original Message-----
From: cf coder [mailto:[EMAIL PROTECTED]
Sent: Monday, March 07, 2005 6:15 AM
To: CF-Talk
Subject: Re: ColdFusion ignores empty list elements
thanks for that guys. I'm still getting an invalid list index error. if
the list has 4 elements and I try to use the listgetat function to get
the 5th element. I get an error.
QuerySetCell(qTmp,"model", listGetAt(list,5));
Is there a way to say if it does not exist, do something else
ex:
<cfscript>
if (listGetAt(list,5)) {
QuerySetCell(qTmp,"model", listGetAt(list,5)); } else{
QuerySetCell(qTmp,"model",""); } </cfscript>
The above code does not work though
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197661
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54