I would like to remove all the characters from my NSString that are not (numerical, alphabetical, come, space, or period).
I am using the NSCharacterSet but it does not have a way of adding to it. I tried the mutable version to add in space, comma, and period but haven't been successful.
// str is my string
NSCharacterSet *charactersToRemove =
[[ NSCharacterSet letterCharacterSet ] invertedSet ];
NSString *trimmedReplacement =
[[ str componentsSeparatedByCharactersInSet:charactersToRemove ]
componentsJoinedByString:@"" ];
// this removes spaces, periods, and commas too. How do I add in to the character set to keep them