fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <limits>
  4. #include <sstream>
  5. #include <string>
  6. #include <vector>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11. istringstream line("\"20170103\",\"MW JANE DOE\",\"NL01 INGB 1234 5678 90\",\"NL02 INGB 1234 5678 90\",\"GT\",\"Af\",\"12,34\",\"Internetbankieren\",\"Mededeling_3\"");
  12. vector<string> lineParts;
  13.  
  14. for(string linePart; line >> quoted(linePart); line.ignore(std::numeric_limits<std::streamsize>::max(), ',')) {
  15. lineParts.push_back(linePart);
  16. }
  17.  
  18. for(const auto& i : lineParts) {
  19. cout << i << endl;
  20. }
  21. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
20170103
MW JANE DOE
NL01 INGB 1234 5678 90
NL02 INGB 1234 5678 90
GT
Af
12,34
Internetbankieren
Mededeling_3