std.conv issues
Yao Gomez
yaoltzin at gSPAMmail.com
Wed Nov 11 14:21:53 PST 2009
It seems that the 'to(T,S)' methods to convert from string to any integer, don't work when the number in the string is not in decimal system. I couldn't find neither in the documentation or the code a function to do this. Example:
---
auto bin = to!long( "0b10111010" );
auto hex = tolong( "0xBADBEEF" );
auto oct = to!long( "013371337" );
---
The first two assignments throw a ConvError exception, and the second one, obviously, is converted in decimal. Is there a way to make this functions work with other numeral systems? Or this is by design?
The funny thing is that there's a function to make the oposite conversion, and it even let you specify the radix.
Yao.
More information about the Digitalmars-d-learn
mailing list