1
2
3
4
5
6
7
8
9
10
11
12
|
/// <summary>
/// Reverse the string.
/// </summary>
/// <param name="text">The String.</param>
/// <returns></returns>
public static string ReverseString(string text)
{
if (text.Length == 1 || String.IsNullOrEmpty(text))
return text;
else
return ReverseString(text.Substring(1)) + text.Substring(0, 1);
}
|