Yes, since our definition of palindrome ignores case. One or the other of these two methods could be used.
Another possibility is to use the String
method
equalsIgnoreCase()
.
But it is probably easiest to ignore case from the start.
Here is the method:
We will soon use the reverse()
method
of StringBuffer
.
But first we need to copy only the characters 'a' through 'z'
into azBuffer
.
This is how
the method ignores spaces and punctuation.
Fill in the blanks with the appropriate methods from class
String
and StringBuffer
.
(Look at the list of methods a few pages back.)