Android sort sqlite query results ignoring case

前端 未结 3 1833
不思量自难忘°
不思量自难忘° 2020-12-30 00:35

just wondering if theres a way of sorting the results of a query ignoring case. Cause at the moment fields starting with an upper case letter are sorted and put on top of th

相关标签:
3条回答
  • 2020-12-30 01:07

    ORDER BY column COLLATE NOCASE;

    See http://www.sqlite.org/datatype3.html#collation

    0 讨论(0)
  • 2020-12-30 01:12

    Convert all entries to lower case for example: select name from table order by LCASE(name)

    LCASE or LOWER (Check documentation)

    0 讨论(0)
  • 2020-12-30 01:13

    On the Android you are given a collation function called LOCALIZED.

    When you specify your column, do the following:

    CREATE TABLE song(..., title TEXT COLLATE LOCALIZED ASC, ...)

    It works great. If you have the Android source code, just do a search for "COLLATE" to see all sorts of examples.

    0 讨论(0)
提交回复
热议问题