www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20184] New: String maxsplit

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

          Issue ID: 20184
           Summary: String maxsplit
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: svnpenn gmail.com

D seems to have no way to limit the number of splits done on a string. This is
possible with Go:

    strings.SplitN("one two three", " ", 2)

also Nim:

   "one two three".split(maxsplit = 1)

also Python:

    'one two three'.split(maxsplit = 1)

also PHP:

    explode(' ', 'one two three', 2);

also Ruby:

    'one two three'.split(nil, 2)

--
Aug 31 2019