Reverse

Reverse a string

源代码:

1
2
3
4
5
6
7
8
9
static class Helpers
{
public static string Reverse(this string s)
{
char[] c = s.ToCharArray();
Array.Reverse(c);
return new string(c);
}
}

示例:

1
2
string s = "Test";
string r = s.Reverse(); // "tseT"
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×