Java tutorial
import java.text.Collator; import java.util.Locale; public class Main { public static void main(String[] args) { Locale USLocale = new Locale("en", "US"); Collator c = Collator.getInstance(USLocale); String str1 = "Java"; String str2 = "HTML"; int diff = c.compare(str1, str2); System.out.print("Comparing using Collator class: "); if (diff > 0) { System.out.println(str1 + " comes after " + str2); } else if (diff < 0) { System.out.println(str1 + " comes before " + str2); } else { System.out.println(str1 + " and " + str2 + " are the same."); } } }