Inverter string

<< Click to Display Table of Contents >>

Navigation:  Funções >

Inverter string

Previous pageReturn to chapter overviewNext page

Função

 

    static class StringHelper

    {

        public static string ReverseString(string s)

        {

            char[] arr = s.ToCharArray();

            Array.Reverse(arr);

            return new string(arr);

        }

    }

 

Usando

 

textBox1.Text = StringHelper.ReverseString(textBox1.Text);