Compare accentuated letters : Collator « I18N « Java Tutorial






import java.text.Collator;
import java.util.Locale;

public class Main {
  public static void main(String args[]) {

    String s1 = "";
    String s2 = "f";

    Collator frCollator = Collator.getInstance(Locale.FRANCE);
    frCollator.setStrength(Collator.CANONICAL_DECOMPOSITION);
    if (frCollator.compare(s1, s2) < 0) {
        System.out.println("s1 < s2");
    }
  }
}
//s1 < s2








13.22.Collator
13.22.1.Compare accentuated letters
13.22.2.Check Equality for two strings with Collator
13.22.3.Sort strings using Collator class
13.22.4.Sort string array with Collator