equalsIgnoreCase()
public boolean equalsIgnoreCase(String anotherString)
-
Compares this
Stringto 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
c1andc2are 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- theStringto compare thisStringagainst.
Returns:
-
trueif the argument is notnulland theStrings are equal, ignoring case;falseotherwise.
See Also:
-
equals(Object),Character.toLowerCase(char),Character.toUpperCase(char)
-
博客主要提及了equalsIgnoreCase()方法,给出了其方法签名public boolean equalsIgnoreCase(String anotherString) ,该方法与字符串比较相关。
997

被折叠的 条评论
为什么被折叠?



