I'm reading a CSV file in C++ and the row format is as such:
"Primary, Secondary, Third", "Primary", , "Secondary", 18, 4, 0, 0, 0
(notice the empty value)
When I do:
while (std::getline(ss, csvElement, ',')) {
csvColumn.push_back(csvElement);
}
This splits up the first string into pieces which isn't correct.
How do I preserve the string when iterating? I tried to do a combination of the above and while also grabbing the lines separated by double quote but I got wild results.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…