字符串中去掉Html格式
2016-06-14 本文已影响0人
RobinZhao
- (NSString *)contentHandleContentWithHtmlString:(NSString *)htmlString {
NSScanner * scanner = [NSScanner scannerWithString:htmlString];
while ([scanner isAtEnd] == NO) {
NSString * text = nil;
[scanner scanUpToString:@"<" intoString:NULL];
[scanner scanUpToString:@">" intoString:&text];
if (text) {
htmlString = [htmlString stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>",text] withString:@""];
}
}
return htmlString;
}