문제

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