Hi,

I'm trying this code: i.e. print out the 1st element of each row

https://run.dlang.io/is/pG921a

void main()
{
    import std.csv;
    import std.stdio: write, writeln, writef, writefln;
    import std.algorithm.comparison : equal;
    string text = "76,26,22";
    auto records = text.csvReader!int;
    foreach(r; records) {writeln(r[0]);}   // line 8
    assert(records.equal!equal([
        [76, 26, 22],
    ]));
}


but I got a compile error:

onlineapp.d(8): Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar)

should `r`'s type be integer array? and how do I access each elelment of the row?

Thanks.

Reply via email to