Escaping a double quote.

Discussion in 'iOS Programming' started by dusker, Jul 22, 2009.

  1. dusker macrumors member

    Joined:
    May 31, 2009
    #1
    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
     
  2. sergio27 macrumors member

    Joined:
    Nov 2, 2008
    #2
    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\"";
     
  3. dusker thread starter macrumors member

    Joined:
    May 31, 2009
    #3
    Hi Sergio
    this worked, thanks so much!
    greetings
    peter
     
  4. peacetrain67 macrumors member

    Joined:
    Dec 20, 2007
    #4
    Use backslash. Example: NSLog(@"Calling \"This View\" Now")
     

Share This Page