equalsIgnoreCase()
public boolean equalsIgnoreCase(String anotherString)
-
Compares this
String
to anotherString
, ignoring (忽略) case (大小写) considerations. 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.Two characters
c1
andc2
are considered the same, ignoring case if at least one of the following is true:- The two characters are the same (as compared by the
==
operator). //两字符相等(相当于= =) - Applying the method
Character.toUpperCase(char)
to each character produces the same result.
//c1经过Character.toUpperCase(char)
处理后 - Applying the method
Character.toLowerCase(char)
to each character produces the same result.
//c1经过Character.toLowerCase(char)
处理后
- The two characters are the same (as compared by the
-
-
-
Parameters:
-
anotherString
- theString
to compare thisString
against.
Returns:
-
true
if the argument is notnull
and theString
s are equal, ignoring case;false
otherwise.
See Also:
-
equals(Object)
,Character.toLowerCase(char)
,Character.toUpperCase(char)
-