Convert strings with different format to float
Tom Kazimiers
2voodoo at gmx.de
Wed Sep 8 09:46:54 PDT 2010
Hi,
On 09/08/2010 05:38 PM, Don wrote:
> Pelle wrote:
>> On 09/08/2010 09:23 AM, Tom Kazimiers wrote:
>>> [ ..]
>>> Maybe a to!float that can cope with
>>> numbers without decimal point.
>>
>> You seem to have found a bug in to!float :-)
>>
>> to!float("123") works as expected, but to!float("0") bugs out. Huh!
>
> Yes, it's a shocking bug. It's been fixed in svn for a couple of weeks,
> but we haven't made a release yet.
>
Great! I am looking forward to that release :-). Any idea when it will
be available?
For the mean time I will, as proposed, make a separate function that
checks if there is a dot in it or not. Then I take to!float and to!int,
respectively.
Cheers,
Tom
More information about the Digitalmars-d-learn
mailing list