Best way to reverse a string
I’ve just had to write a string reverse function in C# 2.0 (i.e. LINQ not available) and came up with this: public string Reverse(string text) { char[] cArray = text.ToCharArray(); string reverse = String.Empty; for (int i = cArray.Length – 1; i > -1; i–) { reverse += cArray[i]; } return reverse; } Personally I’m … Read more