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

5 lines
158 B
OCaml
Raw Permalink Normal View History

2023-07-01 11:58:00 -04: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