go to previous page   go to home page   go to next page

Answer:

Yes: the equalsIgnoreCase() method.


Equals Ignore Case

Let us modify the recursive definition of equals() so that two strings are equal if both strings are the same length, and both strings have the same letters in the same position, but upper and lower case letters are regarded as equivalent.

For example,

equalsIC( "X", "X" ) is true
equalsIC( "X", "x" ) is true
equalsIC( "X+++x", "x+++X" ) is true
equalsIC( "StingRay", "stingRAY" ) is true

This is similar to the method equalsIgnoreCase() of String objects.

  1. If StringA has no characters and StringB has no characters, then the strings .
  2. If StringA has no characters and StringB has some characters, then the strings .
  1. If StringA has some characters and StringB has no characters, then the strings .
  2. Otherwise,
    • convert the first character of each string to lower case.
    • if the first characters are different, then the strings .
    • if the first characters are the same, then the strings if the tails are equalsIC.

QUESTION 23:

Fill each blank in the definition with are equalsIC or with are NOT equalsIC. (Copy and paste.)