Is there a standard way in Ocaml, to convert from (for example) a\n (a three byte string: 0x61,0x5c,0x6e) to a two byte string: 0x61,0x0a ?
My Ocaml program can receive strings with escaped characters, how to “unescape” them?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Nice solution from http://caml.inria.fr/mantis/view.php?id=3888:
let unescape s =Scanf.sscanf ("\"" ^ s ^ "\"") "%S%!" (fun u -> u)