string mixup problem with stdin.byLine
Dave Akers via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Aug 7 22:17:24 PDT 2016
I do believe your problem is with the line...
On Monday, 8 August 2016 at 02:44:20 UTC, torea wrote:
> string cleanLine = strip( cast(string)line );
It's casting a char[] to and immutable(char)[], causing the
mutable buffer from byLine to be used as a string. what you want
is...
string cleanLine = strip( to!string(line) );
which should make a copy of the mutable buffer.
I still a beginner at D but I think that will fix your problem.
-Dave
More information about the Digitalmars-d-learn
mailing list