On Oct 1, 2009, at 4:09 PM, Colin Howarth wrote:

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?

If the data's not too huge, you can read the file into an NSString, break that into lines (there are some NSString methods for this, but I don't remember their names), and then on each line call [line componentsSeparatedByString: @","] to get the values in an NSArray. The values will be strings not numbers, but you can call -intValue or - doubleValue on each one to convert it.

If you have huge amounts of data, like hundreds of thousands of lines, this is going to become noticeably inefficient, so you might need to start reading and parsing directly from the file.

—Jens_______________________________________________

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