Created
December 17, 2014 15:46
-
-
Save ielcoro/c8da8fbf1480f8187945 to your computer and use it in GitHub Desktop.
Aham....
This file contains hidden or 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
/// <summary> | |
/// </summary> | |
public static string Cypher(string input) | |
{ | |
StringBuilder result = new StringBuilder(); | |
Regex regex = new Regex("[A-Za-z]" ); | |
foreach (char c in input) | |
{ | |
if (regex.IsMatch(c.ToString ())) | |
{ | |
int charCode = ((c & 223) - 52) % 26 + (c & 32) + 65; | |
result.Append((char) charCode); | |
} | |
else | |
{ | |
result.Append(c ); | |
} | |
} | |
return result.ToString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment