Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unicode string matching

I want to match two strings with Unicode encoding in Java. I want to match something like:

"asdfeo"
"ásdfeó"

How can I return 0 in the compareTo() method?


EDIT:

When I type a string into an autocomplete view without diacritics (for some reason I don't have the keyboard to write those diacritics), I want to see between the autocomplete suggestions the objects with diacritics. That is why I want to overwrite the compareTo() method.

like image 216
overbet13 Avatar asked Sep 26 '26 18:09

overbet13


1 Answers

What you are looking for is the Collator API.

like image 114
Marko Topolnik Avatar answered Sep 28 '26 06:09

Marko Topolnik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!