Created
January 21, 2010 11:37
-
-
Save spookylukey/282739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See http://www.reddit.com/r/programming/comments/as759/hey_reddit_out_of_these_4_programmers_who_would/ | |
using System; | |
class MainClass { | |
static int Main(string[] argv) { | |
foreach (string s in new string[] {"hello", "λ", Char.ConvertFromUtf32(0x1D161)}) { | |
Console.WriteLine(s); | |
Console.WriteLine(Reverse(s)); | |
} | |
return 0; | |
} | |
// Candidate 3 | |
static string Reverse(string input) | |
{ | |
char[] chars = input.ToCharArray(); | |
Array.Reverse(chars); | |
return new String(chars); | |
} | |
} | |
// Output - hello and λ work as expected, 0x1D161 is a musical note symbol which gets trashed on reversing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment