Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 27, 2011 [Issue 6735] New: splitLines ignores trailing delimiter | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6735 Summary: splitLines ignores trailing delimiter Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: cbkbbejeap@mailinator.com --- Comment #0 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-09-27 03:50:49 PDT --- Both of these should pass, but they currently fail: assert("a\n".splitLines() == ["a", ""]); assert("a\n".splitLines() != ["a"]); This is inconsistent with both "\na".splitLines() and with split(str, delim), as demonstrated here: ---------------------------------- import std.stdio; import std.string; void main() { // assert("a\n".splitLines() == ["a", ""]); assert("a\n".splitLines() != ["a"]); foreach(str; ["a", "a\n", "\na"]) { writefln("\nstr: '%s'", str); foreach(i, line; str.splitLines()) writeln(i, ": ", line); } foreach(str; ["a", "a,", ",a"]) { writefln("\nstr: '%s'", str); foreach(i, line; str.splitLines()) writeln(i, ": ", line); } } ---------------------------------- str: 'a b' 0: a 1: b str: 'a b ' 0: a 1: b str: ' a b' 0: 1: a 2: b str: 'a,b' 0: a 1: b str: 'a,b,' 0: a 1: b 2: str: ',a,b' 0: 1: a 2: b ---------------------------------- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 27, 2011 [Issue 6735] splitLines ignores trailing delimiter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | http://d.puremagic.com/issues/show_bug.cgi?id=6735 --- Comment #1 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-09-27 03:52:29 PDT --- Disregard those two assert lines inside main() in the second code example. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 27, 2011 [Issue 6735] splitLines ignores trailing delimiter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | http://d.puremagic.com/issues/show_bug.cgi?id=6735 --- Comment #2 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2011-09-27 06:25:51 PDT --- https://github.com/D-Programming-Language/phobos/pull/277 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 27, 2011 [Issue 6735] splitLines ignores trailing delimiter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | http://d.puremagic.com/issues/show_bug.cgi?id=6735 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrei@metalanguage.com Resolution| |INVALID --- Comment #3 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-09-27 08:14:52 PDT --- This is by design. Refer to comment in https://github.com/D-Programming-Language/phobos/pull/277. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation