Reverse a string in C#

Lots of people seem to want to do this… one neat way is to utilise Array.Reverse

Pass the string to a char array, use Array.Reverse then pass the char array back as a string.

Public static string ReverseString(string str)
    char[] arr = str.ToCharArray();
    return new string(arr);

Be First to Comment

Leave a Reply