Created
April 27, 2017 18:52
-
-
Save aopell/c8a39f133c1d546dbb4a7c62d978b677 to your computer and use it in GitHub Desktop.
C# Rot-N one-liner
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
static string rot(string s, int n) => return string.Concat(s.Select(x => (char)(x >= 'A' && x <= 'Z' ? (x + n > 'Z' ? x - 26 + n : x + n) : x >= 'a' && x <= 'z' ? (x + n > 'z' ? x - 26 + n : x + n) : x))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment