aryaxt
aryaxt

Reputation: 77646

Objective C - Replacing portion of string in NSString?

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 character.

Any solution?

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

Upvotes: 13

Views: 10915

Answers (1)

John Calsbeek
John Calsbeek

Reputation: 36547

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>"];

Upvotes: 25

Related Questions