Here i need to create the csv file from arrays in to dictionaries, is there any way my arrays are

{
    customerid = 1;
    jewelid = 1;
    reporttype = 1;
    sessionid = 2147483647;
    storeid = 1;
},{
    customerid = 1;
    jewelid = 1;
    reporttype = 0;
    sessionid = 2147483647;
    storeid = 1;
},{
    customerid = 1;
    jewelid = 1;
    reporttype = 0;
    sessionid = 2147483647;
    storeid = 1;
}
有帮助吗?

解决方案

Thats not a CSV file. A CSV usually doesn't have brackets. Perhaps you are looking for the JSON format? But that's json neither, because the ending semicolons should be commas in JSON.

Anyway there are parser classes out there for CSV (eg CHCSVParser) and JSON (eg SBJSON).

See: Where can I find a CSV to NSArray parser for Objective-C?

// edit: Like noted in the comments, most parsers do both ways: reading & writing. Have a look at CHCSVWriter.

其他提示

You have to iterate through the array or dictionary and create the CSV manually by using an NSMutableString.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top