The code from @pad is what I will use because I like to treat strings as immutable, if possible. But I would not use Char.escaped ; he specializes in when you want the vocabulary representation of an OCaml character. So here is what you get if you make this change:
let prefix_char sc = String.make 1 c ^ s let suffix_char sc = s ^ String.make 1 c
Jeffrey scofield
source share