[Issue 10841] std.conv.parse failed when parsing a slice string

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 17 18:51:12 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10841


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-17 18:51:09 PDT ---
The rationale of the change is in the changelog:

http://dlang.org/changelog.html#sliceref

As a workaround you'll have to assign s1[0..2] to another variable and pass it
to parse. A better alternative is to use to!() instead of parse!():

string s1 = "11AB";
auto r = to!int(s1[0..2], 16);

There /was/ some brief discussion about making parse work with slices as well,
since it could be considered convenient (and would avoid code breakage), but
there was no outcome for the 2.063 release.

-- 
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