Hi, everyone,
I am writing an iPhone application, which contains a function. It can convert the NSMutableArray to a CSV file. However, I don't know how to do. Can anyone help me to do this? Thank you very much.
// ------ Update -----
Thank you for everyone reply.
Actually, the array contains the objects of the elements, but I can convent it all to the array like the following (I guess it is more easy to do this).
The array is NSMutableArray *csvArray and the array contains data, like the following example.
csvArray[0] = First Name
csvArray[1] = Last Name
csvArray[2] = Phone
csvArray[3] = Tom
csvArray[4] = Chan
csvArray[5] = 123
csvArray[6] = Peter
csvArray[7] = Wong
csvArray[8] = 456
csvArray[9] = Mary's
csvArray[10] = Cho"w
csvArray[11] = 789...
There are 3 tabs in the begin of the array, which is first name, last name and the phone. For the data, it also contains the " and , symbol. Therefore, I cannot just cut the array by the ',' symbol.
The format I would like to output is the following
//---------------------------
First Name, Last Name, Phone // <- it have the \r\n between each row of data
Tom, Chan, 123
Peter, Wong, 456
Mary's, Cho"w, 789 ...
//---------------------------