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
This NSString category uses the NSXMLParser to accurately remove any HTML tags from an NSString. This is a single .m and .h file that can be included into your project easily.
https://gist.github.com/leighmcculloch/1202238
You then strip html by doing the following:
Import the header:
#import "NSString_stripHtml.h"
And then call stripHtml:
NSString* mystring = @"Hello World!!";
NSString* stripped = [mystring stripHtml];
// stripped will be = Hello World!!
This also works with malformed HTML that technically isn't XML.