字符串中去掉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;
}
上一篇下一篇

猜你喜欢

热点阅读