iOS 替换服务器返回HTML文本中的  &am
2017-10-12 本文已影响22人
木登与木由
html = [html stringByReplacingOccurrencesOfString:@" " withString:@" "];
html = [html stringByReplacingOccurrencesOfString:@"&mdash" withString:@"—"];
html = [html stringByReplacingOccurrencesOfString:@""" withString:@"\""];
html = [html stringByReplacingOccurrencesOfString:@"&hellip" withString:@"..."];
html = [html stringByReplacingOccurrencesOfString:@"&rdquo" withString:@"”"];
html = [html stringByReplacingOccurrencesOfString:@"&lsquo" withString:@"‘"];
html = [html stringByReplacingOccurrencesOfString:@"&rsquo" withString:@"’"];
html = [html stringByReplacingOccurrencesOfString:@"&ldquo" withString:@"“"];
html = [html stringByReplacingOccurrencesOfString:@"&darr" withString:@"↓"];
html = [html stringByReplacingOccurrencesOfString:@"·" withString:@"·"];
- 每个符号后面加上“;”就可以了
比如:html = [html stringByReplacingOccurrencesOfString:@"& n b s p ;" withString:@" "];