blob: 485d8a57260d4dcf9d37773271687384b839a6da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#ifndef CEPIS_SRC_CSV_HPP
#define CEPIS_SRC_CSV_HPP
#include <string>
#include <string_view>
#include <vector>
namespace cepis::detail {
/// Parses RFC 4180 CSV into rows of fields.
///
/// Values may contain commas, quotes and newlines when double-quoted, with
/// `""` as the escape — splitting on `,` would corrupt exactly the street
/// names most likely to matter. A leading UTF-8 BOM is dropped, `\r\n` and
/// `\n` both end a record, and a trailing newline does not produce an empty
/// final row.
std::vector<std::vector<std::string>> parse_csv(std::string_view text);
} // namespace cepis::detail
#endif // CEPIS_SRC_CSV_HPP
|