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 a possible start on the method:
class Tester
{
public boolean test( String trial )
{
String lower = trial.toLowerCase();
StringBuffer azBuffer = new StringBuffer();
for ( int j=0; j < _______________________; j++ )
{
char c = lower.charAt(j);
if ( c >= 'a' && c <= 'z' )
azBuffer.__________( c );
}
. . . .
}
}
public class PalindromeTester
{
. . . . .
}
We will eventually want use the reverse() method
of StringBuffer.
But first we need to copy just the characters 'a' through 'z'
into azBuffer.
Doing this causes
the method to ignore spaces and punctuation (as we want).