Home >>Java String Methods >Java String compareToIgnoreCase() Method
The compareToIgnoreCase() method in Java String is used to lexicographically compares two strings, ignoring the differences in lower case and upper case.
The comparison depends on the Unicode value of each character in the converted to lower case string
public int compareToIgnoreCase(String string2)
string2 This parameter is representing A String and the other string to be compared
Returns:It is used to returns An int value: 0 if the string is equal to the other string, ignoring case differences.
public class MyClass
{
public static void main(String[] args)
{
String strln1 = "phptpoint";
String strln2 = "PHPTPOINT";
System.out.println(strln1.compareToIgnoreCase(strln2));
}
}