Write code for palindrome?

Answer Posted / kautilya

bool CheckPalindrom(string MyString)
{
string strChar1 = "";
string strChar2 = "";
for (int i = 0; i < ((MyString.Length - 1) / 2);
i++)
{
strChar1 = MyString.Substring(i, 1);
strChar2 = MyString.Substring((MyString.Length -
(i+1)), 1);
if (strChar1 != strChar2)
return false;
}
return true;
}

Is This Answer Correct ?    11 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I create image pieces/sub image?

488


Can delegates be used as callbacks?

496


Explain about Destructor method?

549


What are controls in c#?

480


What is console programming language?

487






What is boxing? Explain its functionality?

561


What is inline function in c#?

513


How many constructors can a class have c#?

472


What is “using” statement in c#?

475


How is a string immutable?

496


Explain the difference between arraylist and array and in c#?

504


what are the differences between a class and structure

544


Why singleton class is sealed in c#?

515


How do you declare an arraylist?

498


Which class comes after the SortedList class?

570