取html文件里字符串最快的方法
+ (NSArray *)removeSymbolFromString:(NSString *)string{
NSArray *arr = @[];
if (!string || [string isEqualToString:@""]) {
return [@[]mutableCopy];
}
NSScanner * scanner = [NSScanner scannerWithString:string];
NSString * text = nil;
while([scanner isAtEnd] == NO)
{
//找到标签的起始位置
[scanner scanUpToString:@"<" intoString:nil];
//找到标签的结束位置
[scanner scanUpToString:@">" intoString:&text];
//替换字符
string = [string stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>",text] withString:@"||"];
arr = [string componentsSeparatedByString:@"||"];
}
return arr;
}
本文标题:取html文件里字符串最快的方法
本文链接:https://www.haomeiwen.com/subject/cbotzqtx.html
网友评论