Domanda

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;
}
È stato utile?

Soluzione

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.

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top