csv2bin no longer chokes on CRLF

This commit is contained in:
PikalaxALT 2022-03-16 20:04:17 -04:00
parent 505506dffc
commit 589414d6de

View File

@ -1,6 +1,8 @@
#include <sstream>
#include "CsvFile.h"
static std::string linesep;
void CsvFile::ParseRow(std::string &line, std::vector<std::string> &row, bool resize) {
std::string entry, qbuf;
bool isQuoted = false;
@ -8,6 +10,12 @@ void CsvFile::ParseRow(std::string &line, std::vector<std::string> &row, bool re
if (resize) {
row.clear();
}
while (line[0] == '\r') {
line = line.substr(1);
}
while (line[line.size() - 1] == '\r') {
line = line.substr(0, line.size() - 1);
}
std::stringstream line_s(line);
while (std::getline(line_s, entry, ',')) {
if (!isQuoted && entry[0] == '"') {