Xavier Noria
5/2/2007 12:58:00 PM
On May 2, 2007, at 2:50 PM, Bil Kleb wrote:
> Xavier Noria wrote:
>> Are there many different formats?
>
> Yes, in that the field lengths are different.
>
> No, in that the there are really only three "types":
> integers, vanilla floats, and exponentials.
Then I think you could base the solution on String#index/regexps
depending on the existence of "e" and ".", since we can assume
numbers are well-formed. The idea would be:
if none
%d
elsif "e"
%e
else
%f with computed widths
end
-- fxn