Thread overview
[Issue 11995] std.File.ByLine strips trailing empty line
Dec 13, 2014
Rainer Schuetze
Nov 27, 2015
bb.temp@gmx.com
Mar 21, 2020
Basile-z
December 13, 2014
https://issues.dlang.org/show_bug.cgi?id=11995

Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de

--- Comment #4 from Rainer Schuetze <r.sagitario@gmx.de> ---
I don't think this is a bug. The "standard" line has a trailing newline, you even get warned about it missing for the last line by various programs.

If you want to exactly reproduce the original text use KeepTerminator.yes. This also works for mixed line endings on Windows (CRLF and LF).

--
November 27, 2015
https://issues.dlang.org/show_bug.cgi?id=11995

bb.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bb.temp@gmx.com
         Resolution|---                         |INVALID

--- Comment #5 from bb.temp@gmx.com ---
No, you forgot that the \n is part of the line:

your file is filled with:

"line 1\nline 2\n\n\n"

you expect byLine to output:

["line 1", "line 2", "", "", ""]

but "line 1\nline 2\n\n\n" contains **four** lines, not five:

line1\n
line2\n
\n
\n

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=11995

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--