Difference between matches and equalsIgnoreCase or equals in string class

后端 未结 5 814
一整个雨季
一整个雨季 2020-12-29 09:44

matches: Will check if the complete string entered is equal to the value present in the string object.

equalsIgnoreCase: Ignoring t

5条回答
  •  爱一瞬间的悲伤
    2020-12-29 10:19

    matches() used for verifying---- whether the given string matches to specified regexpression

    ex.;String s = "humbapumpa jim"; assertTrue(s.matches(".(jim|joe)."));

    equals() for just checking the given string with specified string as exact match. equalsIgnoreCase() --- will ignore the case sensitive.

提交回复
热议问题