Taking out non-letters
I'm am currently making a Palindrome program that checks to see if the entered string is a palindrome and if it is not checks if it is a almost-palindrome. An almost-palindrome is defined(by the book) is a palindrome once you remove all punctuation characters and such. I am having trouble doing this using a normal string and/or StringBuffer. This is what I am trying:
Any suggestions would be appreciated.
if((sb.charAt(c)<'a' || sb.charAt(c)>'z')&&(sb.charAt(c)<'A' || sb.charAt(c)>'Z'));
Meditate on Character.isLetter().
Wow, I feel stupid...I accidently put a semi-colon after my if statement
Thanks for the help, Ray.
Last edited by nrz; 05-25-2005 at 06:00 PM.
Wow, I feel stupid not seeing that but I'll lay it on the late hour reply. Still isLetter() is probably the best way to test.
Yep, it's all working correctly now. That makes two of us that should have caught the mistake .
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center