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: @"<"];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…