reading file byLine

Namal via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 3 16:28:36 PDT 2015


On Thursday, 3 September 2015 at 23:25:52 UTC, Jordan Wilson 
wrote:
> And also:
> import std.algorithm
>
> Sorry, I should have taken the time to answer properly and 
> fully.

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

void main(){

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

Error: no property 'array' for type 'MapResult!(__lambda2, 
MapResult!(__lambda1, ByLine!(char, char)))'

Still an error.


More information about the Digitalmars-d-learn mailing list