Skip to content

Instantly share code, notes, and snippets.

@olbrichj
Created May 3, 2018 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olbrichj/4665b10dac953694215f7793b7567f28 to your computer and use it in GitHub Desktop.
Save olbrichj/4665b10dac953694215f7793b7567f28 to your computer and use it in GitHub Desktop.
func rot3(msg: String, op: (UInt32, UInt32) -> UInt32) -> String {
let numbers = msg.unicodeScalars.map{$0.value}
return String(numbers.map{Character(UnicodeScalar(op($0, 3))!)})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment