davedelong / CHCSVParser

A proper CSV parser for Objective-C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need to help on parsing

mithunnt opened this issue · comments

First of all, I am not sure whether it is an issue, but I need a little help here. Couldn't find any valid answer for my problem. We have implemented CHCSVParser in our project to parse CSV files of large sizes. Actually we have a CSV file and need to find the details of a search term. But for parsing the file itself it is taking more time (> 20 sec). We have used following code;
CHCSVParser *p = [[CHCSVParser alloc] initWithContentsOfCSVURL:[NSURL fileURLWithPath:filePath]];
p.delegate = self;
[p parse];
is it the right way to use it? And also which method can I use to search for the details of a term. Like, I enter a value in one of the columns in the CSV file and need to fetch the entire row. Please reply ASAP as we close to dead line.

If the file you're parsing is large, then yes this is the right way to parse it. By implementing a CHCSVParserDelegate, you have control over how much of the parsed contents stay in memory.

CHCSVParser does not provide any affordances for searching within a CSV file; that's entirely up to you to implement.