我想做一个sql语句 -
sqlStatement = [NSString stringWithFormat:@"SELECT * FROM movies where title like '%%@%'",searchKeyword];
Run Code Online (Sandbox Code Playgroud)
但是sqlStatement正在成为 -
"选择*来自电影,其中标题为'%@'"
我想成功
"选择*来自电影,其中标题为'%searchKeyword%'"
如何逃脱"%"字符?
谢谢
Aci*_*ibi 23
试试:
sqlStatement = [NSString stringWithFormat:@"SELECT * FROM movies where title like '%%%@%%'",searchKeyword];
Run Code Online (Sandbox Code Playgroud)
"%%"是打印'%'字符的方式.