In objective-c I want to replace the string "AB\(cd" to "AB\\(cd". This is what I have tried
NSMutableString * str = @"AB\(cd";
NSString * replace = @"\\(";
[str stringByReplacingOccurrencesOfString:@"\("
withString:replace];
NSLog(@"%@",str);
Result is "AB(cd" but I want it as "AB\\\(cd"
Please can somebody help me on this
iOSyou use code (In this case Objective-c) to replace the string so I have replaced this correctlystringByReplacingOccurrencesOfString:withString:returns a string and you don't pass it intostrsostrshould remain as"AB\(cd"when NSLogging it.\(in the string literal."AB\\(CD", and ending I can see it as"AB\\\(CD"