reading CSV text file

Richard Gaskin ambassador at fourthworld.com
Fri Jun 22 19:10:04 EDT 2007


runrev260805 wrote:
 > i have to read a textfile, which is comma separated and contains
 > " as text identifier. The item delimiter is ,
 > My problem is, i do not know, how can i read the file and detect
 > each item of a line, as the items are sepearated by comma and
 > the textfield/items could contain comma, too. How can i tell
 > Revolution to ignore the comma in the "tesxtarea of an item"

I know this probably isn't helpful, but the best solution is to go back 
to the source and ask for a copy of the file in a real format.

CSV is a non-standard hodge-podge of more than a dozen different 
permutations whose only common feature is that commas appear somewhere 
in the file.  They differ in consistency (some use quotes around all 
values, other only text but not numbers) and I've seen many different 
conventions used for escaping, from double quotes to preceding 
backslashes to things weirder and dumber than that.

The self-evident uselessness and inefficiency of the format might have 
allowed it to die of natural causes had it not been support throughout 
Microsoft products.  But by "it" I really mean "them":  Microsoft 
products have each used different variants of CSV, sometimes even in the 
same product changing between versions.

Ugh.

CSV must die.

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com




More information about the use-livecode mailing list