Int.of_string failure

Francois Berenger francois.berenger.working at gmail.com
Fri Nov 16 02:33:26 GMT 2012


(also true for Caml.int_of_string):

The following work:
# Float.of_string "    3.12";;
- : Core.Std.Float.t = 3.12
# Float.of_string "3.12";;
- : Core.Std.Float.t = 3.12
Int.of_string "3";;
- : Core.Std.Int.t = 3

The following does not:
Int.of_string " 3";;
Exception: (Failure "Int.of_string: \" 3\"").

I don't understand why. Bug?

I guess a scanf will work. But I think Int.of_string should work too.

Regards,
F.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/core/attachments/20121115/a39e8670/attachment.html>


More information about the core mailing list