readln() returns new line charater

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Dec 28 09:08:00 PST 2013


On 12/28/13 8:50 AM, Jeroen Bollen wrote:
> On Saturday, 28 December 2013 at 16:49:15 UTC, Jeroen Bollen wrote:
>> Why is when you do readln() the newline character (\n) gets read too?
>> Wouldn't it make more sense for that character to be stripped off?
>
> I just want to add to this, that it makes it really annoying to work
> with the command line, as you kinda have to strip off the last character
> and thus cannot make the string immutable.

Try stdin.byLine, which by default strips the newline.

Andrei



More information about the Digitalmars-d mailing list