Ik have the following strings in the .H file, and i want them to merge into one string at the end of the app when the have collected their data.
It wont work, why开发者_开发百科 not and how must i do it correct so the data collected in these strings will be merged into one string ??
NSString *dataHML;
NSString *dataHML2;
NSString *dataHML3;
NSString *dataHML4;
NSString *dataHML5;
NSString *dataHML6;
NSString *dataHMLtotal = *dataHML + *dataHML2 + *dataHML3 + *dataHML4 + *dataHML5 + *dataHML6;
NSString *dataHtmlTotal = [NSString stringWithFormat:@"%@%@%@%@%@%@", dataHtml, dataHtml2, dataHtml3, dataHtml4,dataHtml5,dataHtml6];
Objective-C does not support operator overloading so + doesn't do what you want here. You can use:
[NSString stringWithFormat:@"%@%@%@%@%@%@", dataHtml, dataHtml2, dataHtml3, dataHtml4, dataHtml5, dataHtml6];
instead.
精彩评论