Created
December 1, 2017 02:53
-
-
Save wagle/58a512790c5e6dd6b9cf8924b0b9fb94 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
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
rot13 := func(r rune) rune { | |
switch { | |
case r >= 'A' && r <= 'Z': | |
return 'A' + (r-'A'+13)%26 | |
case r >= 'a' && r <= 'z': | |
return 'a' + (r-'a'+13)%26 | |
} | |
return r | |
} | |
fmt.Println(strings.Map(rot13, "'Twas brillig and the slithy gopher...")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment