[Issue 16569] Assertion failure on splitter.back on empty string

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Oct 1 11:18:00 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16569

b2.temp at gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp at gmx.com
         Resolution|---                         |INVALID

--- Comment #1 from b2.temp at gmx.com ---
It's not a bug. splitter returns a range, in your case this range is empty. 
The way of iterating/using a range is always to test for emptiness before using
front/back or popFront/Back:

auto rng = str.splitter('.');
if (!rng.empty)
    writeln(rng.back);

--


More information about the Digitalmars-d-bugs mailing list