tags:

views:

73

answers:

1

[[somestring substringtoindex:0] is equaltostring:@"""]; 'makes red' the rest of the code. actually i can't put quotation marks inside quotation marks. still, this is the character i want to reffer. how should I do it in the correct way? thanks

+1  A: 

To escape a character, use the backslash.

@"\"";

And to check if a string exists, use -rangeOfString:.

if ([string rangeOfString:@"\""].location != NSNotFound) { ... }

or -hasPrefix: and -hasSuffix:

if ([string hasPrefix:@"\""]) { ... }
KennyTM