- In C# Reverse String,Receives string and returns the string with its letters reversed.
class Reverse
{
static class StringHelper
{
/// Receives string and returns the string with its letters reversed.
public static string ReverseString(string s)
{
char[] arr = s.ToCharArray();
Array.Reverse(arr);
return new string(arr);
}
}
class Program
{
static void Main()
{
Console.WriteLine(StringHelper.ReverseString("framework"));
Console.WriteLine(StringHelper.ReverseString("samuel"));
Console.WriteLine(StringHelper.ReverseString("example string"));
Console.ReadLine();
}
}
}
No comments