简体   繁体   中英

How to parse CSV files for Iphone

I am working on a iphone project . I want to parse a CSV file. From whatever I found, the

libraries available for CSV parsing is only for MAC , not for iphone. I want a simple approach

for parsing CSV file only for iphone. Any help is greatly appreciated

This is a nice CSV parser with support for streams: https://github.com/davedelong/CHCSVParser

If you are parsing a file that comes from the web, then you could also use https://github.com/acerbetti/AFCSVRequestOperation which is using the AFNetworking library for downloading the file.

CSV is basically a comma separated list of values. You can use NSString methods componentsSeparatedByString: or componentsSeparatedByCharactersInSet: for that.

Suppose you have a comma separated string, calling [myStringCSV componentsSeparatedByString:@","] will give you an NSArray with the values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM