tags:

views:

43

answers:

1

Hello All,

I want to make an sql statement -

sqlStatement = [NSString stringWithFormat:@"SELECT * FROM movies where title like '%%@%'",searchKeyword];

But sqlStatement is becoming -

"SELECT * FROM movies where title like '%@'"

I want to make it

"SELECT * FROM movies where title like '%searchKeyword%'"

How can I escape the "%" character?

Thanks

+3  A: 

Try :

sqlStatement = [NSString stringWithFormat:@"SELECT * FROM movies where title like '%%%@%%'",searchKeyword];

"%%" is the way of printing the '%' character.

Acibi
worked! Thanks!
Saurabh
I'm waiting for 'little Bobby Tables - the movie' to come out.
Pete Kirkham
;) XKCD reference, Great!
Acibi