美文网首页GXiOS
iOS 替换服务器返回HTML文本中的&nbsp &am

iOS 替换服务器返回HTML文本中的&nbsp &am

作者: 木登与木由 | 来源:发表于2017-10-12 16:27 被阅读22次
    html = [html stringByReplacingOccurrencesOfString:@"&nbsp" withString:@" "];
    html = [html stringByReplacingOccurrencesOfString:@"&mdash" withString:@"—"];
    html = [html stringByReplacingOccurrencesOfString:@"&quot" 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:@"&middot" withString:@"·"];
  • 每个符号后面加上“;”就可以了
    比如:html = [html stringByReplacingOccurrencesOfString:@"& n b s p ;" withString:@" "];

相关文章

网友评论

    本文标题:iOS 替换服务器返回HTML文本中的&nbsp &am

    本文链接:https://www.haomeiwen.com/subject/zxloyxtx.html