// CLEAN STRING WITH HTML TAGS
-(NSString *) stringByStrippingHTML:(NSString*) stringWithHtmlTags {
NSRange r;
NSString *s = stringWithHtmlTags;
while ((r = [s rangeOfString:@"<[^>]+>" options:NSRegularExpressionSearch]).location != NSNotFound)
s = [s stringByReplacingCharactersInRange:r withString:@""];
return s;
}
// TO CALL IT
[NameClassHelper stringByStrippingHTML:@"<html><h1>Hellow</h1><p>Snippet!!!</p></html>"]
Remove html tags on strings
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.