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.Code:for(int c=0;c<sb.length();c++) { if((sb.charAt(c)<'a' || sb.charAt(c)>'z')&&(sb.charAt(c)<'A' || sb.charAt(c)>'Z')); { sb.deleteCharAt(c); } }


Reply With Quote
Still isLetter() is probably the best way to test.



Bookmarks