NSCharacterSet 最经常使用的使用方法
NSString *str = @"<p>讨厌的</p>节点<br/></pN>";
//除去字符串中的不想要的 //invertedSet 将去除的反过来变成不去除的
NSCharacterSet *characterSet = [[NSCharacterSet characterSetWithCharactersInString:@"<p/brh>"] invertedSet];
NSString *filtered = [[str componentsSeparatedByCharactersInSet:characterSet] componentsJoinedByString:@""];
//去除两端的空格
NSString *newString = [filtered stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(@"%@",newString);
//除去字符串中的不想要的 //invertedSet 将去除的反过来变成不去除的
NSCharacterSet *characterSet = [[NSCharacterSet characterSetWithCharactersInString:@"<p/brh>"] invertedSet];
NSString *filtered = [[str componentsSeparatedByCharactersInSet:characterSet] componentsJoinedByString:@""];
//去除两端的空格
NSString *newString = [filtered stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(@"%@",newString);