counting the amount of items in a csv

Cubist at aol.com Cubist at aol.com
Tue Feb 1 12:37:35 EST 2005


sez rev at armbase.com:
>I am interested in counting the amount of items in the first line of a
>csv.
>
>How would I do this?
   First off, be aware that CSV is evil. CSV isn't *one* file format, it's an 
arbitrary collection of independently-developed file formats which differ 
from each other in arbitrary ways. because of this, it may not even be *possible* 
to provide a general solution which covers *all* CSV formats.
   Having said all that, there *may* be a simple solution for your particular 
problem. I wouldn't want to raise your hopes prematurely (see 1st paragraph 
above), but have you tried this?

open file WhicheverCSVFile
read from file WhicheverCSVFile until EOF
close file WhicheverCSVFile
put it into Fred
put (the number of items in line 1 of Fred) into TheKount

   Hope this helps...


More information about the Use-livecode mailing list