add CCInt.{of_string,to_string}

This commit is contained in:
Simon Cruanes 2015-08-31 21:17:30 +02:00
parent 42e54fabc5
commit 4946f367ea
2 changed files with 13 additions and 0 deletions

View file

@ -70,3 +70,9 @@ let random_range i j st = i + random (j-i) st
let pp buf = Printf.bprintf buf "%d"
let print fmt = Format.pp_print_int fmt
let to_string = string_of_int
let of_string s =
try Some (int_of_string s)
with _ -> None

View file

@ -56,3 +56,10 @@ val random_range : int -> int -> t random_gen
val pp : t printer
val print : t formatter
val to_string : t -> string
(** @since NEXT_RELEASE *)
val of_string : string -> t option
(** @since NEXT_RELEASE *)