Sorry, I didn't notice the "convert all the elements in it to integer" part. I think I saw reference to the to! before...that is one way to convert.

auto words = file.byLine() // you've all lines in range
                   .map!(a => a.split)
                   .map!(a => to!int(a)).array();


import std.file, std.stdio, std.string, std.conv;

void main(){

        auto file = File("text.txt");
        auto numbers = file.byLine()
               .map!(a => a.split)
               .map!(a => to!int(a)).array();
        
        writeln(numbers);
}

ep18.d(7): Error: no property 'map' for type 'ByLine!(char, char)'


Reply via email to