Skip to content

Instantly share code, notes, and snippets.

@ielcoro
Created December 17, 2014 15:46
Show Gist options
  • Save ielcoro/c8da8fbf1480f8187945 to your computer and use it in GitHub Desktop.
Save ielcoro/c8da8fbf1480f8187945 to your computer and use it in GitHub Desktop.
Aham....
/// <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