On Thu, Oct 1, 2009 at 7:09 PM, Colin Howarth <co...@howarth.de> wrote:

> Hi,
>
> I'd like my app ('tis progressing steadily :-) to read some simple tabular
> data. The original file is from Excel, but it's not too much bother to
> convert it to CSV.
>
> Searching the developer docs gets me
>
> "gestaltGraphicsVersion"
>
> which is not good, but googling "cocoa csv" works very well. The first
> couple of thousand hits seem relevant :-)
>
> Before I go through the 550,000 hits (some of them quite old) dare I ask if
> there's one Right Way (TM) to parse this sort of data?
>

One possible solution I haven't seen mentioned yet is to use RegexKitLite (
http://downloads.sourceforge.net/regexkit/RegexKitLite-3.1.tar.bz2).  The
documentation has an example that parses CSV strings (
http://regexkit.sourceforge.net/RegexKitLite/index.html#RegexKitLiteCookbook_PatternMatchingRecipes_TextFiles_ParsingCSVData).
 When I did some simple benchmarks parsing CSV files using the
documentations example code, it significantly outperformed other solutions
that I tried.  One of those was the MacResearch example that's already been
mentioned, but this was some time ago, so things may have changed and your
milage may vary. It only takes ~17 lines of code to parse CSV strings in to
a NSArray (lines) of NSArrays ('columns') using RegexKitLite, so making
modifications to fit your particular needs is very doable.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to