您的当前位置:首页iOS 替换服务器返回HTML文本中的&nbsp &am

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

2024-12-13 来源:哗拓教育
    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:@" "];
显示全文