MCPcopy Create free account
hub / github.com/davidgiven/luje / equalsIgnoreCase

Method equalsIgnoreCase

lib/java/lang/String.java:792–813  ·  view source on GitHub ↗

Compares the specified string to this string ignoring the case of the characters and returns true if they are equal. @param string the string to compare. @return true if the specified string is equal to this string, false otherwise.

(String string)

Source from the content-addressed store, hash-verified

790 * {@code false} otherwise.
791 */
792 public boolean equalsIgnoreCase(String string) {
793 if (string == this) {
794 return true;
795 }
796 if (string == null || count != string.count) {
797 return false;
798 }
799
800 int o1 = offset, o2 = string.offset;
801 int end = offset + count;
802 char c1, c2;
803 char[] target = string.value;
804 while (o1 < end) {
805 if ((c1 = value[o1++]) != (c2 = target[o2++])
806 && toUpperCase(c1) != toUpperCase(c2)
807 // Required for unicode that we test both cases
808 && toLowerCase(c1) != toLowerCase(c2)) {
809 return false;
810 }
811 }
812 return true;
813 }
814
815 /**
816 * Converts this string to a byte array using the default encoding as

Callers 7

containsMethod · 0.80
containsMethod · 0.80
getCharsetMethod · 0.80
parseBooleanMethod · 0.80
equalsMethod · 0.80
equalsMethod · 0.80

Calls 2

toUpperCaseMethod · 0.95
toLowerCaseMethod · 0.95

Tested by

no test coverage detected