Skip to content

Instantly share code, notes, and snippets.

@zbroyar
Created March 8, 2011 21:08
Show Gist options
  • Save zbroyar/861062 to your computer and use it in GitHub Desktop.
Save zbroyar/861062 to your computer and use it in GitHub Desktop.
Reverse of string
let strrev s =
let len = String.length s in
for i = 0 to ((len/2) - 1) do
let t = s.[i] in
s.[i] <- s.[len - i - 1];
s.[len - i - 1] <- t
done;
s
;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment