Pages

Sunday, July 28, 2013

Removing some character in NSString in xCode

Suppose i don't want ",\': characters in my string then we can apply the below login to remove this from a NSString


NSCharacterSet *doNotWant = [NSCharacterSet characterSetWithCharactersInString:@"\",\\'"];
resultString = [[resultString componentsSeparatedByCharactersInSet: doNotWant] componentsJoinedByString: @""];

NSLog(@"%@", resultString);