Java String function equalsIgnoreCase()

The String equalsIgnoreCase() method compares the two given strings on the basis of content of the string irrespective of case of the string. It is like equals() method but doesn’t check case. If any character is not matched, it returns false otherwise it returns true.

Java String equalsIgnoreCase() method example

public class EqualsIgnoreCaseExample{  
public static void main(String args[]){  
String s1="efaculty";  
String s2="efaculty";  
String s3="EFACULTY";  
String s4="java";  
System.out.println(s1.equalsIgnoreCase(s2));//true because content and case both are same  
System.out.println(s1.equalsIgnoreCase(s3));//true because case is ignored  
System.out.println(s1.equalsIgnoreCase(s4));//false because content is not same  


java java string