[Issue 15545] New: csv Reader line feed '\r' failure
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jan 10 08:07:15 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15545
Issue ID: 15545
Summary: csv Reader line feed '\r' failure
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: gruen_tobias at web.de
If a file uses '\r' line feeds and the last character is a linefeed
(empty line after the data)
Csv Reader will throw a exception at the end of the file.
In case of '\n' or "\r\n" as line-feed this is not the case.
// Will fail
enum failData =
"name, surname, age
Joe, Joker, 99\r";
enum nonFailData =
"name, surname, age
Joe, Joker, 99\r\n";
import std.csv, std.stdio;
void main(string[] args)
{
auto reader = csvReader(failData);
foreach(entry; reader)
{
writeln(entry);
}
}
togrue
--
More information about the Digitalmars-d-bugs
mailing list