How to escape double quotes in string?

cocoa, objective-c

Solution

[s appendString:@"hi there == \"\n\r"];

`\"` is what is needed for `"` - This is standard C formatting.

Problem

I'd like double quotes to appear within the following string so it looks like: ``` "hi there == " ``` Here's the code I'm using: ``` NSMutableString *s = [[NSMutableString alloc] init]; [s appendString:@""""]; [s appendString:@"hi there == ""\n\r"]; ``` Instead I only get: ``` hi there == ``` Any ideas?

Original source