Quantcast
Channel: java.text.Collator treats "v" and "w" as the same letter for Swedish language/locale - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by Lii for java.text.Collator treats "v" and "w" as the same letter...

You could create a custom comparator, which wraps the collator and manually handles v and w the way you want. I have made two implementations of this. The first one is short and elegant, it uses Guavas...

View Article



Answer by VHS for java.text.Collator treats "v" and "w" as the same letter...

This orders waaa before vbbb and vaaa before wbbb. Apparently it treats v and w as the same letter. JDK indeed doesn't treat 'w' and 'v' as the same characters even in Swedish locale. The letter 'v'...

View Article

Answer by DodgyCodeException for java.text.Collator treats "v" and "w" as the...

Create your own RuleBasedCollator. Check the value of the string returned by ((RuleBasedCollator)Collator.getInstance(new Locale("sv", "SE"))).getRules() and modify it to suit your needs and then...

View Article

java.text.Collator treats "v" and "w" as the same letter for Swedish...

The following test passes correctly with Java 8. Comparator<String> stringComparator = Collator.getInstance(new Locale("sv", "SE")); Assert.assertTrue(stringComparator.compare("aaaa", "bbbb")...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images