Re: reading (parsing) CSV (or Excel) data
Re: reading (parsing) CSV (or Excel) data
- Subject: Re: reading (parsing) CSV (or Excel) data
- From: Jens Alfke <email@hidden>
- Date: Thu, 1 Oct 2009 17:22:05 -0700
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 (email@hidden)
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:
This email sent to email@hidden