The point being that if you want an array, use an array.

The whole point of an array is that you want to know that a certain
value is at a certain position.  Therefore, knowing the length of an
array is important.

With a list, the length is unimportant.  It's just a variable to hold a
bunch of values.  It's not "supposed" to be used like an array.  It's
not "supposed" to have a useful "length" value.  The fact that it does
is neither here nor there.  Also, as has been said, if the list value is
empty (ie "s,,,f") then CF will ignore it. That list only has 2 values
in it... because it actually only has 2 values in it.  If it was an
array, it would have 5 positions to store values and would have a lenght
of 5.

Am I making any sense?

It's programming constructs!  I do think it would have been appropriate
to make CF lists similar to arrays, but then all a list would have been
was a string based array.

Think about it for a moment though, if CF had originally had a NULL in
it, then a list with empty values would have made sense.  However,
because there is no such thing as an "empty" value in CF (it's always an
empty string) then if you parsed in a "list" with empty strings in it,
and you were expecting (say) a bunch of numbers, what *should* CF do
with it?  It has no NULL and an empty string is incorrect... should it
be 0 or what?

Anyway, I've rabbitted enough now!  I think I'm quite tired...

Paul

On Thu, 2004-09-23 at 14:00, [EMAIL PROTECTED]
wrote:
> who said anything about arrays?
> 
> 
> 
> 
>                                                                                      
>                                 
>                     Paul Johnston                                                    
>                                 
>                     <[EMAIL PROTECTED]        To:     [EMAIL PROTECTED]              
>                          
>                     tions.com>             cc:                                       
>                                 
>                                            Subject:     Re: [ cf-dev ] number of 
> items in a list                     
>                     23/09/2004                                                       
>                                 
>                     12:44                                                            
>                                 
>                     Please respond                                                   
>                                 
>                     to dev                                                           
>                                 
>                                                                                      
>                                 
>                                                                                      
>                                 
> 
> 
> 
> If you want an array... use an array.
> 
> Lists are useless when you should be using an array.  To get round it,
> count the number of commas and + 1.
> 
> Either that, or loop over the string and create a real array
> (listtoarray won't help here either)...
> 
> Paul
> 
> On Thu, 2004-09-23 at 12:48, [EMAIL PROTECTED]
> wrote:
> > <cfset list="a,b,c,,,,,i">
> >
> > <cfoutput>
> >      #ListLen(list)#
> > </cfoutput>
> >
> > = 4.  i.e. it's not counting the empty elements in the list.  how'd you
> get
> > round that, parse through the list looking for commas?
> >
> >
> >
> 
> 
> --
> These lists are syncronised with the CFDeveloper forum at
> http://forum.cfdeveloper.co.uk/
> Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> CFDeveloper Sponsors and contributors:-
> *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
> by activepdf.com*
>       *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
> proworkflow.com*
>            *Tutorials provided by helmguru.com* :: *Lists hosted by
> gradwell.com*
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 


-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
      *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
           *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

Reply via email to