using System;
static class StringHelper
{
/// <summary>
/// Receives string and returns the string with its letters reversed.
/// </summary>
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"));
}
}
=== Output of the program ===
krowemarf
leumas
gnirts elpmaxe
Friday, January 21, 2011
Example program that reverses strings (C#)
1:59 AM
No comments
0 comments:
Post a Comment