www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10772] New: std.regex.splitter generates spurious empty elements with empty delimiter

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

           Summary: std.regex.splitter generates spurious empty elements
                    with empty delimiter
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: hsteoh quickfur.ath.cx


--- Comment #0 from hsteoh quickfur.ath.cx 2013-08-07 12:54:11 PDT ---
CODE:
--------
void main() {
    import std.string, std.stdio, std.regex;
    string s = "test";
    writeln(std.regex.splitter(s.toUpper, regex("")));
}
--------

Output:
--------
["", "T", "E", "S", "T", ""]
--------

The first and last empty elements should not be included in the result. Cf.
Perl's split(//, "test").

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 07 2013