安东尼奥
BONZO
Zeto
安吉拉
当sqlite数据库在该列中有重音时,如何正确订购?
谢谢
解决方法 或... ORDER BY column ColLATE UNICODE
要么
... ORDER BY column ColLATE LOCAliZED
Reference:
In addition to sqlite’s default
BINARY
collator,AndroID supplIEs two more,LOCAliZED
,which changes with the system’s current locale,andUNICODE
,which is the Unicode Collation Algorithm and not tailored to the current locale.
例:
db.execsql("CREATE table foo(a TEXT);");db.execsql("INSERT INTO foo VALUES('Antonio'),('Bonzo'),('Zeto'),('Ángela');");Cursor c = db.rawquery("SELECT * FROM foo ORDER BY a ColLATE UNICODE",null);while (c.movetoNext()) { Log.d("foo",c.getString(0));}
输出:
ÁngelaAntonioBonzoZeto总结
以上是内存溢出为你收集整理的android – 通过带有重音字符的列排序sqlite的问题(Á)全部内容,希望文章能够帮你解决android – 通过带有重音字符的列排序sqlite的问题(Á)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)