How to remove html tags from a parsed text on iOS?
问题 I am parsing a text and store it in a NSString variable. However when I try to display the NSString on screen I can see, within the text, the html tags like: <br> . How can I remove this tags from my text and replace them with a space or something? 回答1: NSString *str = @"This is<br>a string"; str = [str stringByReplacingOccurrencesOfString:@"<br>" withString:@""]; 回答2: -(NSString *) stringByStrippingHTML { NSRange myRange; NSString *myString = [[self copy] autorelease]; while ((myRange =