NSString *test = @"d'escape";
NSLog(@"%@", [test stringByReplacingOccurrencesOfString:@"'" withString:@"\'"]);
prints me this
2010-10-25 15:10:54.833 MyApp[7136:207] d'escape
What am I doing wrong ? I want to get this :
2010-10-25 15:10:54.833 MyApp[7136:207] d\'escape
\
itself is a special character in C. You need to escape it in the source.
[test stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]
// ^^
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