On Mon, 30 Jan 2012 21:01:38 -0500, bearophile wrote:
> > In D to!int(" 12\n") gives a run-time error. So time ago I have weakly > asked Andrei to change to!int, to let it ignore leading and trailing > whitespace, but he has ignored my request. > > A leading newline comes often from input stdin.readln() and other > sources. So in D you need to add a strip(): > > int n = to!int(stdin.readln().strip()); > > Bye, > bearophile Try parse!int(" 12\n"); http://www.d-programming-language.org/phobos/std_conv.html#parse -- Yep, I'm afraid that I have a blog : zardoz.es