Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Clarify the concept of a line for text sort #301
The problem raises from the "new-line" after "A". If lines are separated by "line-line" this text has 5 lines (the last is empty) and the correct result is:
If lines are terminated by "new-line" we have 4 lines and the correct result is "A B C D".
The usual thing that happens in theses cases (in editors and in programs that interpret text files) is to consider the last line-ending optional. So if there's no LF after the last line (as in your second example) it is silently assumed to be there.
This means that both examples above yield the same result.