I have an NSString and want to save it in CSV format. Because of this, I am replacing all " with "". I tried the following code but the compiler reports an error for it.
newString = [oldstring stringByReplacingOccurrencesOfString:@""" withString:@""""];
where oldstring is 11th ave, "L&T", Khar. oldstring is set from user input.
How can I end up with newString set to 11th ave, ""L&T"", Khar?
Any help will be appreciated.
You need to escape double quotes (
") inside your string: