There isn’t an NSString method that does that. You’ll have to write your own function that does string replacements. It is sufficient to do the following replacements:
- ‘&’ => “&”
- ‘”‘ => “"”
- ‘\” => “'”
- ‘>’ => “>”
- ‘<‘ => “<”
Something like this should do (haven’t tried):
[[[[[myStr stringByReplacingOccurrencesOfString: @"&" withString: @"&"]
stringByReplacingOccurrencesOfString: @"\"" withString: @"""]
stringByReplacingOccurrencesOfString: @"'" withString: @"'"]
stringByReplacingOccurrencesOfString: @">" withString: @">"]
stringByReplacingOccurrencesOfString: @"<" withString: @"<"];