diff options
author | Nicolás Ojeda Bär <n.oje.bar@gmail.com> | 2018-02-28 09:28:47 +0100 |
---|---|---|
committer | Nicolás Ojeda Bär <n.oje.bar@gmail.com> | 2018-02-28 09:28:47 +0100 |
commit | 35a75212dc9f75f5df1f03a7093ed8a60d8eb139 (patch) | |
tree | d60ad257a7d78c8f24cb7b10ea6b7d0dbb43e235 /stdlib/string.ml | |
parent | 3cfb0bfe6fd48b4479bf85f06051c73d55c8193c (diff) | |
download | ocaml-35a75212dc9f75f5df1f03a7093ed8a60d8eb139.tar.gz |
Use local function
Diffstat (limited to 'stdlib/string.ml')
-rw-r--r-- | stdlib/string.ml | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/stdlib/string.ml b/stdlib/string.ml index ffecee90cc..6a46b82833 100644 --- a/stdlib/string.ml +++ b/stdlib/string.ml @@ -100,13 +100,13 @@ let trim s = then bts (B.trim (bos s)) else s -let rec escape s n i = - if i >= n then s else - match unsafe_get s i with - | '\"' | '\\' | '\000'..'\031' | '\127'.. '\255' -> bts (B.escaped (bos s)) - | _ -> escape s n (i+1) - let escaped s = + let rec escape s n i = + if i >= n then s else + match unsafe_get s i with + | '\"' | '\\' | '\000'..'\031' | '\127'.. '\255' -> bts (B.escaped (bos s)) + | _ -> escape s n (i+1) + in escape s (length s) 0 (* duplicated in bytes.ml *) |