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 equality ignore case. Both of these methods are used for comparing two strings. ... Java does not let you supply an external "equality comparer": when you use strings, HashSet uses only built-in hashCode and equals. For e.g. String A is dsycuii343qzx899+ty= String B is dsycuii343qzx899+ty= so, I then checked length of the two string which gave me the clue. String A length = 20 String B length = 21

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 with strings converted to a specific (i.e. 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.

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.