RosettaCodeData/Task/Determine-if-a-string-is-numeric/OCaml/determine-if-a-string-is-numeric.ocaml
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

9 lines
188 B
Text

let is_int s =
try ignore (int_of_string s); true
with _ -> false
let is_float s =
try ignore (float_of_string s); true
with _ -> false
let is_numeric s = is_int s || is_float s