This should be simple but it’s not working. I am trying to strip single quote marks from an NSString named parms using the following (stripped of non-relevant vars in the format string):
NSString *newVar =[[NSString alloc] initWithFormat:@"%@", [parms stringByReplacingOccurrencesOfString:@"'" withString:@""]];
So if parms contains “Mike’s Hat” I would expect that newVar would contain “Mikes Hat”. Instead it contains “Mike’s Hat”.
There must be more to your code than you are proving, but the following works perfectly:
Output: Mikes Hat
There could be a possibility that the character
'may not be the same character in your parms string if the above does not work for you.Turns out, you are using the wrong character copy/paste this character into your string:
’