File .. byLine
Joel
joelcnz at gmail.com
Mon Dec 3 06:09:21 UTC 2018
I can't seem to get this to work!
```
foreach(line; File("help.txt").byLine) {
writeln(line.stripLeft);
```
With the code above, I get this compile error:
source/app.d(360,36): Error: template
std.algorithm.mutation.stripLeft cannot deduce function from
argument types !()(char[]), candidates are:
/usr/local/opt/dmd/include/dlang/dmd/std/algorithm/mutation.d(2602,7): std.algorithm.mutation.stripLeft(Range, E)(Range range, E element) if (isInputRange!Range && is(typeof(range.front == element) : bool))
/usr/local/opt/dmd/include/dlang/dmd/std/algorithm/mutation.d(2610,7): std.algorithm.mutation.stripLeft(alias pred, Range)(Range range) if (isInputRange!Range && is(typeof(pred(range.front)) : bool))
I just want to use each 'line' variable as a string?! I've tried
'byLineCopy', and 'line.to!string'. I've looked at documentation.
More information about the Digitalmars-d-learn
mailing list