NSString *textString = @"abcd334%$^%^%80)(*^ujikl";
//this is for remove the specified characters
NSCharacterSet *chs = [NSCharacterSet characterSetWithCharactersInString:@"'#%^&{}[]/~|\?.<,"];
NSString *resultString = [[textString componentsSeparatedByCharactersInSet:chs] componentsJoinedByString:@""];
//this is for get the specified characters
NSCharacterSet *chs1 = [[NSCharacterSet characterSetWithCharactersInString:@"'#%^&{}[]/~|\?.<,"] invertedSet];
NSString *resultString1 = [[textString componentsSeparatedByCharactersInSet:chs1] componentsJoinedByString:@""];
NSLog(@"tex : %@",resultString);
NSLog(@"reverse string : %@",resultString1);
out put:
text : abcd334$80)(*ujikl
reverse string : %^%^%^