Reputation: 1221
How can I write a "
inside an Objective-C string?
For example I have the
NSString *sql= @"select * from test where name="name"";
Upvotes: 0
Views: 876
Reputation: 3709
say you have string like @"abc"def"123";
do it like @"abc\"def\"123";
Upvotes: 0
Reputation: 78393
NSString* name = @"Jason";
NSString* selectStatement = [NSString stringWithFormat:@"select * from foo where name = \"%@\"", name];
Upvotes: 0
Reputation: 26134
Use \"
. In your case it would be:
NSString *sql= @"select * from test where name=\"name\""
Upvotes: 4