https://leetcode-cn.com/problems/valid-palindrome/
class Solution {
public boolean isPalindrome(String s) {
for (int i=0;i<s.length();i++){
if (!iscode(s.charAt(i))){
s=s.replace(Character.toString(s.charAt(i)),"");
}
}
for (int i=0;i<s.length();i++){
if (!iscode(s.charAt(i))){
s=s.replace(Character.toString(s.charAt(i)),"");
}
}
for (int i=0;i<s.length()/2;i++){
if (trans(s.charAt(i))!=trans(s.charAt(s.length()-i-1))){
return false;
}
}
return true;
}
public static char trans(char c){
if (c>='A'&&c<='Z'){
return (char) (c+32);
} else {
return c;
}
}
public static boolean iscode(char c){
if ((c>='A'&&c<='Z')||(c>='a'&&c<='z')||(c>='0'&&c<='9')){
return true;
}else {
return false;
}
}
}