如何解码应删除或替换为
等适当字符的html应替换为“”(空格)。
其他特殊角色怎么样?
答案 0 :(得分:3)
您可以自己创建一个方法,如下所示:
+ (NSString *) replaceHTMLEntitiesInString:(NSString *) htmlString {
htmlString = [htmlString stringByReplacingOccurrencesOfString:@" " withString:@" "];
htmlString = [htmlString stringByReplacingOccurrencesOfString:@""" withString:@"\""];
htmlString = [htmlString stringByReplacingOccurrencesOfString:@"<" withString:@"<"];
htmlString = [htmlString stringByReplacingOccurrencesOfString:@">" withString:@">"];
return htmlString;
}