我的NSString是這樣的:如何從NSString的去掉標題和結尾空格的
NSString *myString =
(
「\n \n 24 K CLUB」,
「\n \n 3 DOLLAR CAFE」,
「\n \n A PEACH OF A PARTY」,
「\n \n A ROYAL AFFAIR CAFE」,
「\n \n AFFAIRS TO REMEMBER CATERERS」,
「\n \n AFRIKAN DELI」 )
如何擺脫這個新行字符和空格,讓我的新字符串將像: newString:
(
"24 K CLUB」,
"3 DOLLAR CAFE」,
「A PEACH OF A PARTY」,
「A ROYAL AFFAIR CAFE」,
「AFFAIRS TO REMEMBER CATERERS」,
「AFRIKAN DELI」
)
我想:
myString = [myString stringByReplacingstringByReplacingOccurrencesOfString:@"\n" withString:@""];
myString = [myString stringByReplacingstringByReplacingOccurrencesOfString:@" " withString:@""];
但unsuccessfully..getting錯誤:
[__NSArrayI stringByReplacingOccurrencesOfString:withString:]: unrecognized selector sent to instance 0x7062200
保存某人幾秒鐘: '[myString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];'' – 2015-03-02 06:29:08