On Friday, 18 September 2015 at 10:26:46 UTC, Namal wrote:
Hello guys, is there a nice functional way to read the file which is like1,2,3,4,5,6 2,3,4,5,6,7 8,9,0,9,2,3 line by line, split numbers and remove each ',' convert it to int and save in a matrix int[][] arr?
Not tested, but I think the following should work: auto matrix = str .byLine .map!((l) => l.split(",") // Split each line .map!(to!int) // Turn into ints .array) // Return an array .array // Copy into an array