开发者

Objective C - Replacing portion of string in NSString?

开发者 https://www.devze.com 2023-03-19 14:45 出处:网络
I am using the following code to replace a portion of the string, this works for normal characters (alphabetical characters) but when it comes to symbols like \"•\" it can\'t replace the 开发者_Stack

I am using the following code to replace a portion of the string, this works for normal characters (alphabetical characters) but when it comes to symbols like "•" it can't replace the 开发者_StackOverflow社区character.

Any solution?

[myString stringByReplacingOccurrencesOfString:@"•" withString:@"<BULLET_POINT>"];


You may not be able to literally insert non-ASCII characters like "•" in a source file. Try using the escape \u2022 instead.

myString = [myString stringByReplacingOccurrencesOfString:@"\u2022" withString:@"<BULLET_POINT>"];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号