There are a couple of different ways to remove HTML tags
from an NSString
in Cocoa
.
One way is to render the string into an
You can use like below
-(void)myMethod
{
NSString* htmlStr = @"html";
NSString* strWithoutFormatting = [self stringByStrippingHTML:htmlStr];
}
-(NSString *)stringByStrippingHTML:(NSString*)str
{
NSRange r;
while ((r = [str rangeOfString:@"<[^>]+>" options:NSRegularExpressionSearch]).location != NSNotFound)
{
str = [str stringByReplacingCharactersInRange:r withString:@""];
}
return str;
}