lineSplitter ignores the the trailing newline?

Jonathan Marler johnnymarler at gmail.com
Sat Nov 9 23:04:11 UTC 2019


On Saturday, 9 November 2019 at 19:28:52 UTC, Paul Backus wrote:
> On Saturday, 9 November 2019 at 19:00:31 UTC, Jonathan Marler 
> wrote:
>> In people's opinion, should lineSplitter handle files with 
>> trailing newlines differently or the same?  Currently, 
>> lineSplitter will ignore the trailing newline.  If it didn't 
>> ignore it, then I'd expect that a file with a trailing newline 
>> would return an empty string as its last element, but it 
>> doesn't do this.
>
> lineSplitter follows the Unix convention of treating newlines 
> as line *terminators* rather than line *separators* (as we can 
> see from the name of its template argument "KeepTerminator"). 
> Under this convention, a trailing newline terminates the final 
> line in a file, but does not start a new one, so there is no 
> need for an additional empty line.

Interesting, do you have any links and or references that 
establish that unix uses newlines as terminators rather than 
separators?


More information about the Digitalmars-d mailing list