OTP: erlang:list_to_float

Bengt Kleberg bengt.kleberg@REDACTED
Thu May 12 10:46:51 CEST 2005


Alexander Williams wrote:
> erlang-questions:

...deleted
>   Is it really INTENDED that erlang:list_to_float("3") blows up with a
>   badarg?  I  mean,  yes,  in  theory I could go looking through for a
>   period  before  passing  data  in,  but  that  seems  a  little  ...
>   complicated for something that's not truly a bad argument.

perhaps you could use ''catch'' to guard against the exception? and use 
erlang:list_to_integer/1 incase of a problem?

alternativly you have io_lib:fread/2 .


bengt



More information about the erlang-questions mailing list