reading file byLine

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 3 16:31:12 PDT 2015


On Thu, Sep 03, 2015 at 11:28:36PM +0000, Namal via Digitalmars-d-learn wrote:
> 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.

	import std.array : array;


T

-- 
Do not reason with the unreasonable; you lose by definition.


More information about the Digitalmars-d-learn mailing list