Re: How to best parse a CSV data file and do a lookup in C?

From: Randy Howard (randyhoward_at_FOOverizonBAR.net)
Date: 11/23/04


Date: Tue, 23 Nov 2004 18:04:28 GMT

In article <d0a001b7.0411191558.5685bff5@posting.google.com>,
websnarf@gmail.com says...
> Ok, Johnny Google. I've written a usable CSV parser here:
>
> http://www.pobox.com/~qed/bcsv.zip
>
> It, in fact, can parse out the complete CSV standard (which includes
> quoting so you can put a commas, lead/trailing spaces and in fact
> quotes themselves in any given field) and thus should easily be able
> to handle that case you are concerned with.

Is there actually a "standard" for CSV? I was under the impression that
there was a wide variety of "similar" implementations by various vendors
that had subtle differences and formatting which made it difficult to have
a one size fits all CSV implementation.

http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm

Not trying to argue, just curious how your implementation attempts to
deal with variations in CSV usage.

-- 
Randy Howard (2reply remove FOOBAR)
"For some reason most people seem to be born without the part 
 of the brain that understands pointers." -- Joel Spolsky


Relevant Pages

  • Re: CSV files... argh!
    ... when I have to work with those pesky things it's on some other host. ... As there is no such thing like *one* CSV standard: ... I once saw a long awk script for doing all this, but the problem is, usually ...
    (comp.unix.shell)
  • Re: Fastest way to read data to populate combo controls?
    ... dumping the whole thing into a CSV and parse it using VB. ... When you talk about using a CSV, Ralph, I have no clue how VB would ... The Excel macro creates a Word document with six tables: ... If bPath Then ...
    (microsoft.public.vb.general.discussion)
  • Re: parsing a dbIII file
    ... I have to parse a file whose stucture look like ... If the format is similar to Excel's CSV format then the csv module from Python's standard library may well be what you want. ... I am not sure whether the pipe bars actually appear in your data file, so it is difficult to know quite exactly what to suggest, but I would play with the file in an interactive interpreter session first to see whether csv can do the job. ...
    (comp.lang.python)
  • Re: CSV files
    ... no but next time I need to parse a csv I shall certainly look into it. ... Mark Broadbent ... "Konrad L. M. Rudolph" wrote in message ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Fastest way to read data to populate combo controls?
    ... dumping the whole thing into a CSV and parse it using VB. ... When you talk about using a CSV, Ralph, I have no clue how VB would ... The Excel macro creates a Word document with six tables: ... "How To Use ADO with Excel Data from Visual Basic or VBA"http://support.microsoft.com/kb/257819 ...
    (microsoft.public.vb.general.discussion)