I am taking the input from a text box then looping though it backward and creating the output string. after the loop is done I test the input text against the output text. If its true then its Palindrome.
private void palindromeTest_bt_Click(object sender, RoutedEventArgs e)
{
if (palindromeInput_tb.Text != string.Empty)
{
string inputText = palindromeInput_tb.Text;
string outputText = string.Empty;
string letter = string.Empty;
for (int i = inputText.Length - 1; i >= 0; i--)
{
letter = inputText.Substring(i, 1);
outputText += letter;
}
if (inputText == outputText)
{ MessageBox.Show("Text is Palindrome"); }
else
{ MessageBox.Show("Text is Not Palindrome"); }
}
}
0 Comments On This Entry
Trackbacks for this entry [ Trackback URL ]
Tags
My Blog Links
Recent Entries
-
-
-
Mega Project ideal list. - "Text" section / Check if Palindromeon Oct 04 2012 10:45 AM
-
-
Search My Blog
0 user(s) viewing
0 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)
Categories
|
|



Leave Comment










|