I got ~30000 rows of data in an app that I would like to add to a CSV file and email to the user. Each data point currently has ~20 properties and I’m adding ~20 more values as extended attributes, stored in a NSMutableDictionary. That’s a lot of data, and it already takes ~10 seconds to create the file and attach it to an email.
I can build a string of CSV values from regular properties using
[NSString stringWithFormat:@"%f,%f,%f",prop1,prop2,prop3 ];
I can iterate the dictionary like this. I can repeatedly build a string for each key, but this would re-create a new string each time. Is there an equivalent of StringBuilder or StringBuffer in iOS?
for(NSString *aKey in myDictionary){
NSLog(aKey);
//append string
}
What’s the best way to combine existing properties and extended attributes from an NSMutableDictionary to create a single string of comma separated values?
Initialize a mutable string outside the for loop and append it however you want.