Unexpected ' ' when converting from type string to type int

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Dec 29 17:38:32 PST 2015


On Wednesday, 30 December 2015 at 01:36:56 UTC, Michael S wrote:
>     auto matrix_size = readln;

Change that to

auto matrix_size = readln.strip;


and you should be in business. readln() returns any leading 
spaces and the newline character at the end of the line too, 
which is why to is throwing.

The .strip function will trim that whitespace off.


More information about the Digitalmars-d-learn mailing list