[Issue 17109] std.csv chokes on empty columns when parsing to struct

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jan 19 09:38:41 PST 2017


https://issues.dlang.org/show_bug.cgi?id=17109

--- Comment #5 from Sophie <meapineapple at gmail.com> ---
(In reply to Jack Stouffer from comment #4)
> (In reply to Sophie from comment #3)
> The problem is, if I just get strings, then std.csv is useless because I can
> just do this
> 
>     auto input = File("file.csv");
>     auto data = input.byLine.map!(a => splitter(a, ','));

Not that I don't understand your argument, but be aware the example is not at
all equivalent to parsing a CSV; it does not handle quoted columns or escaped
metacharacters.

Null for nullable types would work, I think. I don't think using nan is ideal
but it's probably the best solution for floats, the issue is that integers
would have no such capability and this would an unusual inconsistency to have
between the numeric types.

Perhaps when a type other than string is expected, it will be made nullable if
it's not already and null will be returned when the column is blank?

--


More information about the Digitalmars-d-bugs mailing list