Posted on Leave a comment

Collator

Performing Locale-Independent Comparisons

[code language=”java”]
Collator c = Collator.getInstance(new Locale("ru"));
//c.setStrength(Collator.PRIMARY);
System.out.println(c.compare("JOHN", "JOHN"));
System.out.println(c.compare("JOHN", "John"));
System.out.println(c.compare("JOHN", "john"));
System.out.println("JOHN".compareTo("bill"));
[/code]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.