-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht-csv.cc
More file actions
39 lines (29 loc) · 721 Bytes
/
Copy patht-csv.cc
File metadata and controls
39 lines (29 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <lvv/csv.h>
using namespace lvv;
using namespace std;
int main() {
string csv =
"a\"\"b\"\"c\n"
"a\"\"\"b\"\"\"c\n"
"\"a\"\"b\"\"c\"\n"
",\n"
"a\n"
",a\n"
"a,\n"
"a,\" a\"a,b\"b \"\n"
"aa,b\"b,c\"c, d ,,ee,ff, g\"g,h\"h \n" "aa, bb,cc ,\" dd\",\"ee \",\"f, g\n" ", h\",\"i,\"\"j,k\"\",l\"\n";
istringstream is(csv);
while (true) {
typedef vector <string> rec_t;
rec_t rec = csv_get_line(is);
if (rec.size() == 0) break;
for (rec_t::iterator x = rec.begin(); x != rec.end(); ++x) {
cout << '>' << *x << "<\n";
}
cout << string(20, '*') << '\n';
}
}