Follow by Email

Tuesday, July 2, 2013

Logic to reverse a word string in c# | reverse a string in c#.net

hi a basic code on how to reverse a word(string) in c#.net.

Logic :

string reverseStr()
        {
            string s = "programming";
            char[] c = s.ToCharArray();
            string strReverse = "";
            for (int i = c.Length - 1; i > -1; i--)
            {
                strReverse += c[i];
            }

            return strReverse;
        }

Example: