Question : String is a palindrome or not program !!

Hi,

Can you please provide this simple program for me in VC#.NET - "CHECK WHETHER A STRING IS PALINDROME OR NOT" ?

Thanks

Answer : String is a palindrome or not program !!

Hello milani_lucie,

The following code is taken from http://www.daniweb.com/forums/thread72744.html

Regards,

Dabas
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
bool CheckPalindrome (string CheckString)
{
     if (CheckString == null || CheckString.Length == 0) 
     {
        return false;
     }
     for (int i = 0; i < CheckString.Length / 2; i++)
     {
         if (CheckString[i] != CheckString[CheckString.Length - 1 - i])
         {
            return false;
         }
     }
     return true;
}
bool CheckPalindrome (string CheckString)
{
     if (CheckString == null || CheckString.Length == 0) 
     {
        return false;
     }
     for (int i = 0; i < CheckString.Length / 2; i++)
     {
         if (CheckString[i] != CheckString[CheckString.Length - 1 - i])
         {
            return false;
         }
     }
     return true;
}
Random Solutions  
 
programming4us programming4us