2017-02-10 77 views
0

我从服务器接收到以下字符串。从字符串中删除\ U00a0 - iOS

body = "Subject: This is from webportal \nTo: My Account \n...\n\n\nLTD Emojis:100k:ltd:eyes:trophy \nDefault Emoji \\ud83d\\ude1b\\ud83d\\ude31\\ud83d\\ude0d \\ud83d\\ude3b\U00a0\\ud83d\\ude48  \n-- \nStephen acc"; 

我想从字符串中删除“\ U00a0”。这里是代码删除,但它不工作。

testString=[testString stringByReplacingOccurrencesOfString:@"\\U00a0" withString:@""]; 

有没有其他办法可以完成这件事。

+0

你应该参考[this](http://stackoverflow.com/questions/668228/string-replacement-in-objective-c)的问题。 – Nicolas

+0

哪一个....? –

+0

点击链接,“这个” – Nicolas

回答

0

对于任何其他人谁得到了这个问题。这是这条线的简单改变。它解决了我的问题。

testString=[testString stringByReplacingOccurrencesOfString:@"\u00a0" withString:@""];