Why does this not work?

bachmeier via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 1 07:06:53 PST 2016


On Friday, 1 January 2016 at 14:47:20 UTC, TheDGuy wrote:
> On Friday, 1 January 2016 at 14:29:34 UTC, Tobi G. wrote:
>> On Friday, 1 January 2016 at 14:20:26 UTC, Tobi G. wrote:
>>> The solution is that readln() returns a string that also 
>>> contains the newline
>>> this can be solved by easily stripping the newline off
>>>
>>> import std.string;
>>>
>>> int i = to!int(input.strip);
>>
>> Sorry my bad english.. i wrote solution but meant problem
>
> Thank you very much! That helped me alot. It is kind of hard if 
> you don't have the background knowledge...

I've battled with a few times, not having any idea what was going 
on. I now almost automatically use strip when it's not working.


More information about the Digitalmars-d-learn mailing list