不区分大小写,使用Firebase orderByChild进行排序 [英] Case insensitive sorting with Firebase orderByChild
问题描述
项目1,项目2,项目3,aItem,bItem,zItem。
如何使用orderByChild导致不区分大小写的排序?
如果您有要排序的数据,但还需要用户对该数据的表示,请保留两个版本
posts
post_id_0
display_version:William
sort_version:william
post_id_1
display_version:Henry
sort_version:henry
当然,您可以读取Firebase中的所有数据并使用。 toLower或任何您的平台调用,然后在代码中进行排序。
I’m using a FirebaseRecyclerAdapter to display a list of strings. My query uses orderByChild. The results sorts with capitalize letters first and looks like this:
Item 1, Item 2, Item 3, aItem, bItem, zItem.
How do I use orderByChild resulting in case insensitive sorting?
You don't. Kind of.
If you have data you want to sort by but there also needs to be a user representation of that data, keep two versions
posts
post_id_0
display_version: William
sort_version: william
post_id_1
display_version: Henry
sort_version: henry
Of course you could read in all of the data from Firebase and use .toLower or whatever your platform call is and then sort in code.
这篇关于不区分大小写,使用Firebase orderByChild进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!