readln() returns new line charater

bearophile bearophileHUGS at lycos.com
Sat Dec 28 08:59:50 PST 2013


Jeroen Bollen:

> 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.


void main() {
     import std.stdio, std.string;
     immutable txt = readln.chomp;
     writeln(">", txt, "<");
}


Bye,
bearophile


More information about the Digitalmars-d mailing list