Monday, August 01, 2005

the jackol’s den»Blog Archive » Reverse a String in C# - Mikhail Esteves

the jackol’s den»Blog Archive » Reverse a String in C# - Mikhail Esteves: "If you need a function to reverse a string in C#, here it is!

private string ReverseString(string InputStr)
{
char[] Chars = InputStr.ToCharArray();
int Length = InputStr.Length-1;

for (int x=0;x {
Chars[x] ^= Chars[Length];
Chars[Length] ^= Chars[x];
Chars[x] ^= Chars[Length];
}

return new string(Chars);
}"
Post a Comment