Here you can find the source of equalsIgnoreCaseAndAccent(String string1, String string2, Locale locale)
public static boolean equalsIgnoreCaseAndAccent(String string1, String string2, Locale locale)
//package com.java2s; //License from project: Open Source License import java.text.Collator; import java.util.Locale; public class Main { public static boolean equalsIgnoreCaseAndAccent(String string1, String string2) { return compareIgnoreCaseAndAccent(string1, string2) == 0; }/*from w w w. j a va 2s . co m*/ public static boolean equalsIgnoreCaseAndAccent(String string1, String string2, Locale locale) { return compareIgnoreCaseAndAccent(string1, string2, locale) == 0; } /** * Performs a string comparison ignoring case and accent. Beginning and ending spaces are trimmed. * * @param string1 * string to be compared. * @param string2 * string to be compared. * @param locale * The locale to perform the comparison. * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the * second. */ public static int compareIgnoreCaseAndAccent(String string1, String string2, Locale locale) { if (string1 == null || string2 == null) { if (string1 == null && string2 == null) return 0; if (string1 == null) return -1; return 1; } Collator collator = Collator.getInstance(locale); collator.setStrength(Collator.PRIMARY); collator.setDecomposition(Collator.FULL_DECOMPOSITION); return collator.compare(string1, string2); } /** * Performs a string comparison ignoring case and accent. Beginning and ending spaces are trimmed. * * @param string1 * string to be compared. * @param string2 * string to be compared. * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the * second. */ public static int compareIgnoreCaseAndAccent(String string1, String string2) { return compareIgnoreCaseAndAccent(string1, string2, Locale.getDefault()); } }