2017-02-10 78 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:@""];