module String = struct include String let explode s sep = let len = length s in let buff = Buffer.create 40 in let rec loop i = if i >= len then [ Buffer.contents buff ] else let c = s.[i] in if c == sep then let ss = Buffer.contents buff in Buffer.clear buff; ss :: loop (i+1) else begin Buffer.add_char buff c; loop (i+1); end in loop 0 end ;;