美文网首页
iOS之过滤字符串的HTML标签

iOS之过滤字符串的HTML标签

作者: 见哥哥长高了 | 来源:发表于2018-05-22 12:55 被阅读38次

-(NSString *)filterHTML:(NSString *)html
{
NSScanner * scanner = [NSScanner scannerWithString:html];
NSString * text = nil;
while([scanner isAtEnd]==NO)
{
[scanner scanUpToString:@"<" intoString:nil];
[scanner scanUpToString:@">" intoString:&text];
html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>",text] withString:@""];
}
return html;
}

相关文章

网友评论

      本文标题:iOS之过滤字符串的HTML标签

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