How do I remove double quotes from an NSString. Example:
//theMutableString: "Hello World"
[theMutableString replaceOccurrencesOfString:@"\"" withString:@"" options:NSCaseInsensitiveSearch range:(NSRange){0,[theMutableString length]}]
It doesn't seem to work, maybe since I had to escape the " in the replaceOccurrencesOfString?
Use the NSMakeRange
function instead of your cast. This'll work:
[mString replaceOccurrencesOfString:@"\"" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mString length])];
How about this ?
NSCharacterSet *quoteCharset = [NSCharacterSet characterSetWithCharactersInString:@"\""];
NSString *trimmedString = [toBeTrimmedString stringByTrimmingCharactersInSet:quoteCharset];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With