I’m making a Java app that receives some names from SQLite and puts them on a listbox.
The thing is I want it to be accurately ordered in an ascending alphabetical way (In Portuguese to be specific).
These entries, for example:
Beta
Árida
Ana
Should be ordered as:
Ana
Árida
Beta
But since it orders in some ASCII order, the “accented” characters on will be thrown at the end and not right below the letter they correspond to.
Result:
Ana
Beta
Árida
How can I solve this? EDIT: I meant resolving the issue with Java itself and not with SQlite improvements
Thanks in advance.
You can read the names first into a regular
List<String>, and then useCollections.sort()to sort the list. To specify a locale-sensitive ordering, use a Collator.E.g
The names will then be sorted alphabetically. You may need to use collator.setStrength(SECONDARY) to get it to “ignore” differences due to accents. The behaviour is language specific so I can’t say for sure.