| Below is the code to check whether string is palindrone or not here i have used while and if else loop
private static bool TestPallindrome(string strVal)
{
try
{
int min = 0;
int max = strVal.Length - 1;
while (true)
{
if (min > max)
return true;
char minChar = strVal[min];
char maxChar = strVal[max];
if (char.ToLower(minChar) != char.ToLower(maxChar))
{
return false;
}
min++;
max--;
}
}
catch (Exception)
{
throw;
}
}
| | |