<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I'd like to io_lib:fread() a number from a string.  Unfortunately, if I use "~f" for floating point number, then fread rejects numbers that don't have fractional parts:<br><br>> io_lib:fread("~f", "1").<br>{error,{fread,float}}<br>> io_lib:fread("~f", "1."). <br>{error,{fread,float}}<br><br>(I find this very strange, since both 1 and 1. can be represented in a floating point number.)<br>And if I use "~d" for decimal integers, then fread won't read past the decimal point:<br><br>> io_lib:fread("~d", "1.0").<br>{ok,[1],".0"}<br><br>What is the easiest way to scan a number from a string in erlang?  Ideally it would scan any number in any input format and return an Erlang object that satisfied the is_number() predicate.<br><br>Thank you,<br><br>BF<br><br></td></tr></table><br>