Android SQlite查询以检索数字大于7且小于15的联系人。排除所有特殊字符
有谁能帮我在SQlite中编写查询吗。 我想从native中检索号码大小大于7且号码大小小于15的联系人列表 92 78 56 9876543215 987-456-123320201 +321456 在上述数字中。我只想要两个。休息我不想在我的名单上 通常我们可以写作Android SQlite查询以检索数字大于7且小于15的联系人。排除所有特殊字符,android,sql,sqlite,Android,Sql,Sqlite,有谁能帮我在SQlite中编写查询吗。 我想从native中检索号码大小大于7且号码大小小于15的联系人列表 92 78 56 9876543215 987-456-123320201 +321456 在上述数字中。我只想要两个。休息我不想在我的名单上 通常我们可以写作 "length(" + Phone.NUMBER + ") >= 7 and length(" + Phone.NUMBER + ") <= 15" 987-456-123320201将不显示,+321456将显
"length(" + Phone.NUMBER + ") >= 7 and length(" + Phone.NUMBER + ") <= 15"
987-456-123320201将不显示,+321456将显示。
谢谢你的回复。但我不想保留纪念印。我想直接将列表检索到cursor对象中,并使用CursorLoader来显示。al是arraylist的对象,它将存储您的编号。我不想维护任何对象数组。我知道通过使用arraylist对象我们可以实现它。我想要光标。为什么要创建arraylist对象。我想优化代码。
// To Retrive the data from database
public ArrayList<Integer> getdata(String table)
{
ArrayList<Integer> al=new ArrayList<Integer>();
int number=0;
Cursor c= sdb.rawQuery("select * from "+table+"", null);
if(c!=null)
{
while(c.moveToFirst())
{
number=c.getInt(0);// 0 represtnt here column name
int length = (int) Math.log10(number) + 1;
if(length>7 && lenth<15)
{
al.add(number);
}
}
}
return al;
}