This looks like just the thing for your caveman vintage data format dealings:


A CHCSVParser works very similarly to an NSXMLParser, in that it synchronously parses the data and invokes delegate callback methods to let you know that it has found a field, or has finished reading a line, or has encountered a syntax error.

A CHCSVParser can be created in one of three ways:

  1. With a path to a file
  2. With the contents of an NSString
  3. With an NSInputStream

CHCSVParser can be configured to parse other “character-seperated” file formats, such as “TSV” (tab-seperated). You can change the delimiter of the parser prior to beginning parsing. The delimiter can only be one character in length, and cannot be any newline character, #, “, or \…

Writing and various conveniences also included.

And just in case it actually doesn’t handle whatever you throw at it, previously we’ve found the cocoadev ReadWriteCSVAndTSV page of valuable assistance with this kind of problem.

Alex | January 5, 2012

Leave a Reply