• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: reading (parsing) CSV (or Excel) data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: reading (parsing) CSV (or Excel) data
      • From: Rick Genter <email@hidden>
    • Re: reading (parsing) CSV (or Excel) data
      • From: BareFeet <email@hidden>
References: 
 >reading (parsing) CSV (or Excel) data (From: Colin Howarth <email@hidden>)

  • Prev by Date: Re: IB webview oddity/question...
  • Next by Date: Re: reading (parsing) CSV (or Excel) data
  • Previous by thread: reading (parsing) CSV (or Excel) data
  • Next by thread: Re: reading (parsing) CSV (or Excel) data
  • Index(es):
    • Date
    • Thread