even on using equalsIgnoreCase gave me false. In equalsIgnoreCase () method, two strings are considered equal if they are of the same length and corresponding characters in the two strings are equal ignoring case.
possible duplicate of Is the Contains Method in java.lang.String Case-sensitive? Java String equalsIgnoreCase () method. The equalsIgnoreCase() method of String class generally compare two string in terms of their character sequence regardless of case. This java tutorial shows how to use the equalsIgnoreCase() method of java.lang.String class. – Eric Feb 20 '13 at 4:29 Since you're new to StackOverflow, please don't forget to mark the best option as the answer – Luiggi Mendoza Feb 20 '13 at 5:06
Two strings are considered equal ignoring case if they are of the same length and corresponding characters in the two strings are equal ignoring case.
Ask Question Asked 5 years, 9 months ago. Java String equalsIgnoreCase () method is used to compare a string with the method argument object, ignoring case considerations. This method returns boolean data type which signifies if the String is equal to the parameter String regardless of case. As you can see from its name also that the name is equalsIgnoreCase and hence there must be something like equality checking and IgnoreCase shows that Case should be ignored means that we have to compare the equality of two things without considering their cases. Java Set
public boolean equalsIgnoreCase(String anotherString) Compares this String to another String, ignoring case considerations. It is like equals() method but doesn't check case. You can work around this problem by populating an auxiliary HashSet
I was clueless because when I was printing those string (A & B) to check what they look like they were . In this tutorial we will discuss equals () and equalsIgnoreCase () methods. The only difference between them is that the equals () methods considers the case while equalsIgnoreCase () methods ignores the case during comparison. Java String equalsIgnoreCase() method compares two strings irrespective of the case (lower or upper) of the string. If any character is not matched, it returns false otherwise it returns true. Applying the method java.lang.CharactertoUpperCase(char)to each character produces the same result Applying the method java.lang.CharactertoLowerCase(char) to each character produces the same result My thoughts: So using equalsIgnoreCase we iterate through the Strings (only if their size values are the same) comparing each char.