Subscribe to danzar's Blog        RSS Feed
-----

Mega Project ideal list. - "Text" section / Reverse a String

Icon Leave Comment
The ideal here is to responded to the text box "TextChanged" event with a loop though the text backwards saving it to a new string that I displayed in the output text box.


 private void reverseInput_tb_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (reverseInput_tb.Text != string.Empty)
            {
                string inputText = reverseInput_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;
                }
                reverseOutput_tb.Text = outputText;
            }
        }

0 Comments On This Entry

 

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

November 2014

S M T W T F S
      1
2345678
9101112131415
16171819202122
232425 26 272829
30      

Tags

    Search My Blog

    0 user(s) viewing

    0 Guests
    0 member(s)
    0 anonymous member(s)