summaryrefslogtreecommitdiff
path: root/stdlib/scanf.ml
diff options
context:
space:
mode:
authorFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2012-01-08 15:38:38 +0000
committerFabrice Le Fessant <Fabrice.Le_fessant@inria.fr>2012-01-08 15:38:38 +0000
commitd02419cef712af9cc580b7aadfebacfa75901ec4 (patch)
treee7754cc5d6ee8772cf0cd5b091d81a2ebee76f45 /stdlib/scanf.ml
parent288ebd8cbcf201c42cc865a1cadb93292ddad59f (diff)
downloadocaml-d02419cef712af9cc580b7aadfebacfa75901ec4.tar.gz
Fix bug #3888 (String.map and Scanf.unescaped)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12004 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/scanf.ml')
-rw-r--r--stdlib/scanf.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/stdlib/scanf.ml b/stdlib/scanf.ml
index 11abe0212e..2bfd45cc6c 100644
--- a/stdlib/scanf.ml
+++ b/stdlib/scanf.ml
@@ -1488,7 +1488,8 @@ let bscanf ib = kscanf ib scanf_bad_input;;
let fscanf ic = bscanf (Scanning.from_channel ic);;
-let sscanf s = bscanf (Scanning.from_string s);;
+let sscanf : string -> ('a, 'b, 'c, 'd) scanner
+ = fun s -> bscanf (Scanning.from_string s);;
let scanf fmt = bscanf Scanning.stdib fmt;;
@@ -1521,6 +1522,9 @@ let format_from_string s fmt =
sscanf_format (string_to_String s) fmt (fun x -> x)
;;
+let unescaped s =
+ sscanf ("\"" ^ s ^ "\"") "%S%!" (fun x -> x)
+
(*
Local Variables:
compile-command: "cd ..; make world"