-(NSString*)filterHTML:(NSString*)html
{
NSScanner* scanner = [NSScannerscannerWithString:html];
NSString* text =nil;
while([scannerisAtEnd]==NO)
{
//找到标签的起始位置
[scannerscanUpToString:@"<"intoString:nil];
//找到标签的结束位置
[scannerscanUpToString:@">"intoString:&text];
//替换字符
html = [htmlstringByReplacingOccurrencesOfString:[NSStringstringWithFormat:@"%@>",text]withString:@""];
}
// NSString * regEx = @"<([^>]*)>";
// html = [html stringByReplacingOccurrencesOfString:regEx withString:@""];
returnhtml;
}
网友评论