开发者

Parsing question

I would like to use cCSVParse http://michael.stapelberg.de/cCSVParse

in my project. I receive csv data from internet and want to parse it and save to core data. cCSVParse seems to be appropriate class of it. But it can only read csv data from file. When I receive data from internet, I wouldn't like to save it 开发者_运维百科to file. Is there any way to use it for parsing data from NSData or NSString?


One approach is to surround the CSV data (one row at a time) with [] chars and parse it with a JSON parser. (But note that this only works if the non-numeric data items are enclosed in quotes.)

Or you can simply use

NSArray* items = [csvRow componentsSeparatedByString:@","];

if the data items aren't enclosed in quotes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜