Is there a way to correctly sort international strings in Android? I use a custom comparator, and a compareTo() method, but it’s not enough for me. I want letters like this “ö” to be displayed near “o”, but all of them are at the end of the list. How can I force the comparator to think they are similar to “o, a, etc…”?
Is there a way to correctly sort international strings in Android? I use a
Share
To locale-sensitive string comaprision use
Collator. From docs:Example of comparing strings:
prints
1.If you want to sort list of strings using above collator, you can write:
prints:
EDIT: Just spotted that you are Polish, so Polish example below: