int (char c1, char c2, boolean ignoreCase) { // duplicating String.equalsIgnoreCase logic int d = c1 - c2; if (d == 0 || !ignoreCase) { return d; } // If characters don't match but case may be ignored, // try converting both characters to uppercase. // If the results match, then the comparison scan should // continue. char u1 = StringUtilRt.toUpperCase(c1); char u2 = StringUtilRt.toUpperCase(c2); d = u1 - u2; if (d != 0) { // Unfortunately, conversion to uppercase does not work properly // for the Georgian alphabet, which has strange rules about case // conversion. So we need to make one last check before // exiting. d = StringUtilRt.toLowerCase(u1) - StringUtilRt.toLowerCase(u2); } return d; }