Home >Web Front-end >HTML Tutorial >Remove HTML tags in NSString_html/css_WEB-ITnose

Remove HTML tags in NSString_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:41:411288browse

-(NSString *)filterHTML:(NSString *)html
{
NSScanner * scanner = [NSScanner scannerWithString:html];
NSString * text = nil;
while([scanner isAtEnd ]==NO)
{
//Find the starting position of the label
[scanner scanUpToString:@">" intoString:&text];
                                                                                                                                                                                                                              ;
}
NSString * regEx = @"<([^>]*)>";
html = [html stringByReplacingOccurrencesOfString:regEx withString:@""];
return html ;
}

Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn