This is a simple code using for loop to find out Reverse sting of a given string.
public static string ReverseString(string Str)
{
int len = Str.Length;
StringBuilder revStr = new StringBuilder();
for (int i = len - 1; i >= 0; i--)
{
revStr.Append(Str[i]);
if (i != 0)
{
revStr.Append(' '); // Provide space between each character
}
}
return revStr.ToString();
}
No comments:
Post a Comment