Bug 16587 – split("", "x") should be []

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-10-03T22:08:00Z
Last change time
2016-10-09T15:38:10Z
Assigned to
nobody
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2016-10-03T22:08:54Z
/////////////// test.d /////////////// import std.string; void main() { assert("".split(",").length == 0); } ////////////////////////////////////// Introduced in https://github.com/dlang/phobos/pull/4030. Additionally, the new behavior is inconsistent: split("") => [] split("", ",") => [""] splitLines("") => []
Comment #1 by dlang-bugzilla — 2016-10-03T22:10:55Z
Example real-life scenarios: - Comma-delimited lists in program arguments or configuration files. The string variables will be empty unless populated, then split afterwards. - `libPaths ~= environment.get("LIBPATH", null).split(":")` will now search the current directory.
Comment #2 by github-bugzilla — 2016-10-04T03:09:03Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/d6572c2a44d69f449bfe2b07461b2f0a1d6503f9 Fix Issue 16587 - split("", "x") should be "" This reverts commit b438bf5a0653b616ef6debe2a0dfe247d8fc5928. https://github.com/dlang/phobos/commit/e3f842d52a3eedc7c8f6a5e75f26de05d5cf1fea Merge pull request #4836 from CyberShadow/pull-20161003-223010 Fix Issue 16587 - split("", "x") should be ""
Comment #3 by andrei — 2016-10-04T13:25:51Z
Thanks, Vladimir!
Comment #4 by github-bugzilla — 2016-10-09T15:38:10Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/d6572c2a44d69f449bfe2b07461b2f0a1d6503f9 Fix Issue 16587 - split("", "x") should be "" https://github.com/dlang/phobos/commit/e3f842d52a3eedc7c8f6a5e75f26de05d5cf1fea Merge pull request #4836 from CyberShadow/pull-20161003-223010