I was clueless because when I was printing those string (A & B) to check what they look like they were .

Java String equalsIgnoreCase() method compares two strings irrespective of the case (lower or upper) of the string. Java Set equality ignore case. 1. This java tutorial shows how to use the equalsIgnoreCase() method of java.lang.String class. This method returns boolean data type which signifies if the String is equal to the parameter String regardless of case. public boolean equalsIgnoreCase(String anotherString) Compares this String to another String, ignoring case considerations. It is like equals() method but doesn't check case.
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. Java String equalsIgnoreCase() The String equalsIgnoreCase() method compares the two given strings on the basis of content of the string irrespective of case of the string. 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 String equalsIgnoreCase () method is used to compare a string with the method argument object, ignoring case considerations. Ask Question Asked 5 years, 9 months ago. If any character is not matched, it returns false otherwise it returns true. Both of these methods are used for comparing two strings. String A length = 20 String B length = 21 You can work around this problem by populating an auxiliary HashSet with strings converted to a specific (i.e. possible duplicate of Is the Contains Method in java.lang.String Case-sensitive? The equalsIgnoreCase() method of String class generally compare two string in terms of their character sequence regardless of case.

even on using equalsIgnoreCase gave me false. 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. For e.g. The only difference between them is that the equals () methods considers the case while equalsIgnoreCase () methods ignores the case during comparison. – 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 ... Java does not let you supply an external "equality comparer": when you use strings, HashSet uses only built-in hashCode and equals.

In this tutorial we will discuss equals () and equalsIgnoreCase () methods. String A is dsycuii343qzx899+ty= String B is dsycuii343qzx899+ty= so, I then checked length of the two string which gave me the clue. Java String equalsIgnoreCase () method. 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.