RosettaCodeData/Task/Rot-13/OCaml/rot-13-1.ocaml

5 lines
158 B
Text
Raw Permalink Normal View History

2013-04-10 23:57:08 -07:00
let rot13 c = match c with
| 'A'..'M' | 'a'..'m' -> char_of_int (int_of_char c + 13)
| 'N'..'Z' | 'n'..'z' -> char_of_int (int_of_char c - 13)
| _ -> c