CF has always ignored blank elements.....annoying... but there are
workarounds.



-----Original Message-----
From: Martin Thorpe [mailto:[EMAIL PROTECTED] 
Sent: 07 August 2006 13:41
To: CF-Talk
Subject: Re: CF Arrays

One thing that tripped me up about arrays recently was that when using
listToArray or arrayToList it drops any blank elements. 

So if you have
arMy[1] = "hello";
arMy[2] = "";
arMy[1] = "again";

If you put this through arrayToList it will be an arraylen of 2 not 3.

This might not affect anyone but I was parsing tab delimeted data with
blanks on some rows and not others so it screwed up the inserts.  Putting a
[space] in for the blank sorts the problem.

cheers
Martin 

> I was getting an error that appeared to be randomly occurring in one 
> of my sites: "The element at position [n] cannot be found"
> Eventually I traced it to the fact that I had been using ArrayLen to 
> set the number of iterations for a loop when the array size had been 
> expanding. The code was therefore trying to reference empty array 
> elements and causing the error. 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:248985
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to