CKTIS / Java
String.equalsIgnoreCase — case-insensitive comparison
String.equalsIgnoreCase compares strings without distinguishing letter case, independently of locale. It returns boolean.
Version: Java SE 21; repository runtime, production runtime not attested
Syntax
public boolean equalsIgnoreCase(String anotherString)String.equalsIgnoreCase requires equal string lengths and matching corresponding Unicode code points. Points match if identical or if Character.toLowerCase(Character.toUpperCase(int)) produces the same result.
A null argument yields false; invoking the method on a null receiver throws NullPointerException. Unlike this method, equals distinguishes letter case.
The method ignores locale; use Collator for language-sensitive comparisons. It does not equate ß with SS: their lengths differ.
Examples
public class Main {
public static void main(String[] args) {
System.out.println("Java".equalsIgnoreCase("jAvA"));
System.out.println("Java".equals("jAvA"));
System.out.println("Java".equalsIgnoreCase(null));
System.out.println("ß".equalsIgnoreCase("SS"));
}
}Result
true false false false
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.