Given a string ,determine if it is a palindrome,considering only alphanumeric characters and ignoring cases;
根据给定的字符串,判断是否回文,只考虑为字符的情况 忽略大小写
code example:
public static bool isPralindrome(string e)
{
e = e.ToLower();
int left = 0;
int right = e.Length - 1;
while (left < right)
{
if (!Char.IsLetterOrDigit(e.ElementAt(left)))
{
left++;
}else if (!Char.IsLetterOrDigit(e.ElementAt(right)))
{
right--;
}else if (e.ElementAt(left) != e.ElementAt(right))
{
return false;
}
else{
left++;
right--;
}
}
return true;
}