digitalmars.D.learn - std.conv issues
- Yao Gomez (9/9) Nov 11 2009 It seems that the 'to(T,S)' methods to convert from string to any intege...
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.
Nov 11 2009