using System;
using System.Text;
class MainClass
{
public static string ReverseString(string str)
{
if (str == null || str.Length <= 1)
{
return str;
}
StringBuilder revStr = new StringBuilder(str.Length);
for (int count = str.Length - 1; count > -1; count--)
{
revStr.Append(str[count]);
}
return revStr.ToString();
}
public static void Main()
{
Console.WriteLine(ReverseString("The quick brown fox jumped over the lazy dog."));
}
}
The output:
.god yzal eht revo depmuj xof nworb kciuq ehT
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |