Should we have a `String.rev` in `Stdlib`?

It’s not exactly an easy one-liner though, there’s some index manipulation.

let rev x =
  let len = String.length x in
  String.init len (fun n -> String.get x (len - n - 1));;

But I agree that if no one else chimes in here to signal that String.rev is generic enough, it need not be in the String module.

3 Likes