www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - std.conv question.

reply Q <Q Q.qom> writes:
Does to! (uint) recognize  hexadecimal strings?
Cause if i put
int by = to!(int)("0x0FFF");
throws an exception saying;
std.conv.ConvError: Can't convert value `x0FFF' of type const(char)[] to type
int
dmd 2.031;
Jul 15 2009
parent BCS <ao pathlink.com> writes:
Reply to Q,

 Does to! (uint) recognize  hexadecimal strings?
 Cause if i put
 int by = to!(int)("0x0FFF");
 throws an exception saying;
 std.conv.ConvError: Can't convert value `x0FFF' of type const(char)[]
 to type int
 dmd 2.031;
BTW: You have posted three copties of the same question. IIRC there is a function that parses hex but clealy 'to' is not it. Grep the docs for "hex" and it should pop up.
Jul 15 2009