gpt4 book ai didi

iphone - SQLite查询使用SQLite的“like”子句查找相似的单词

转载 作者:行者123 更新时间:2023-12-03 18:31:47 25 4
gpt4 key购买 nike

在我的iPhone应用程序中,我需要搜索SQLite数据库。

我将根据用户在文本框中输入的内容搜索类似的数据。

我想要的是:

我想要查询

如果用户输入A,则从类别表中选择类别,其中类别如“ A%”

我试过了

NSString *query = [NSString stringWithFormat:@"Select category from categorytable where category like '%@%'",textbox1.text];


用户输入的字符后不显示“%”。

在控制台中,它显示为

**Select category from categorytable where category like 'A'**  which is incorrect


查询应该是什么?

最佳答案

您需要在stringWithFormat中使用%%。

关于iphone - SQLite查询使用SQLite的“like”子句查找相似的单词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4202312/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com