Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dusker

macrumors member
Original poster
May 31, 2009
41
0
Hi,
this is probably very simple, but i've been googling this with no result.
I need to have a string with several double quotes in it. How do you escape double quote in objective-c? (since obviously @"It is called "monument""; doesnt work :)

thanks
peter
 
Hi, dusker. I'm almost positive that you just need to put an inverted slash ('\') before the double quote for it to work. I'm not in my Mac right now so I can't confirm it.

NSString *sample = @"It is called \"monument\"";
 
Hi,
this is probably very simple, but i've been googling this with no result.
I need to have a string with several double quotes in it. How do you escape double quote in objective-c? (since obviously @"It is called "monument""; doesnt work :)

thanks
peter

Use backslash. Example: NSLog(@"Calling \"This View\" Now")
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.