mirror of
https://github.com/pret/pokeheartgold.git
synced 2025-03-03 18:48:02 +00:00
csv2bin no longer chokes on CRLF
This commit is contained in:
parent
505506dffc
commit
589414d6de
@ -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] == '"') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user