ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

ReverseString

for reverse string

Source

public static string ReverseString(this string s)
{
    char[] charArray = s.ToCharArray();
    Array.Reverse(charArray);
    return new string(charArray);
}

Example

string number = "123456789".ReverseString(); //987654321

Author: Phakawan Wongpetanan

Submitted on: 22 feb. 2014

Language: C#

Type: System.String

Views: 4677