Java String equalsIgnoreCase Example
String class equalsIgnoreCasemethod example
String class equalsIgnoreCase method example. This example shows you how to use equalsIgnoreCase method.This method Compares this String to another String, ignoring case considerations.
Syntax:-equalsIgnoreCase(String anotherString)
Here is the code:-
/**
* @(#) EqualsIgnoreString.java
*Program that Compares this String to another String, ignoring case considerations.
* @Version 01-May-2008
* @author Rose India Team
*/
class EqualsIgnoreString
{
public static void main(String[] args)
{
//Declaration of first string
String str1 = "Welcome to RoseIndia";
//Declaration of first string
String str2 = "Welcome to RoseIndia Team";
// Compares this String to another String, ignoring case considerations.
boolean equals1 = str1.equalsIgnoreCase(str2);
//Displaying boolean value for result
System.out.println( str1 + " equals" + str2 + ":-" + equals1);
}
} |
null
|