Georg Wrede wrote:
Readln returns a string which contains the line terminator.
Is there a grand reason for this?
Currently there are a few drawbacks with this. The naive user doesn't
expect it, and the seasoned user has to keep stripping it. And then he
has to search the docs (or get hold of other OSs) to determine what
terminator to expect on other systems.
And it can't really be a speed optimization either, because to do
anything useful with a string, you have to strip the terminator anyway
at some point.
By default, tango does not exhibit this behavior. If you wish, you can
include newlines:
auto str = Cin.copyln; // no newline in str
auto str2 = Cin.copyln(true); // has system-dependent newline