[Issue 7692] New: std.conv.parse should do lookahead for "0x" in	strings with radix 16
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sun Mar 11 19:50:22 PDT 2012
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=7692
           Summary: std.conv.parse should do lookahead for "0x" in strings
                    with radix 16
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-03-11 19:50:29 PDT ---
import std.conv;
void main()
{
   string s1 = "ff";
   string s2 = "0xff";
   assert(parse!uint(s1, 16) == 0xff);  // ok
   assert(parse!uint(s2, 16) == 0xff);  // fail, it's 0
}
parse should pop the first two characters if the string starts with 0x.
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list