Java String Accent equalsIgnoreAccentsAndCase(String s1, String s2)

Here you can find the source of equalsIgnoreAccentsAndCase(String s1, String s2)

Description

equals Ignore Accents And Case

License

Apache License

Declaration

public static boolean equalsIgnoreAccentsAndCase(String s1, String s2) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.Normalizer;

public class Main {
    public static boolean equalsIgnoreAccentsAndCase(String s1, String s2) {
        return equalsIgnoreAccents(s1.toLowerCase(), s2.toLowerCase());
    }//w w  w  .j a v  a2  s  .  com

    public static boolean equalsIgnoreAccents(String s1, String s2) {
        return stripAccents(s1).equals(stripAccents(s2));
    }

    public static String stripAccents(String str) {
        return Normalizer.normalize(str, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
    }
}

Related

  1. deAccent(String str)
  2. deAccent(String str)
  3. deAccent(String str)
  4. deleteAccents(String text)
  5. equalsIgnoreAccents(String lhs, String rhs, Locale locale)
  6. equalsIgnoreCaseAndAccent(String string1, String string2, Locale locale)
  7. equalsStringIgnoringAccents(String str1, String str2)
  8. getDeAccentLoweredChars(String word)
  9. normalizeByRemovingAccent(final String string)