16 const std::vector<std::string>& vec,
char sep,
char quote,
char escape) {
19 if (vec.empty())
return out;
21 for (
size_t i = 0; i < vec.size(); ++i) {
25 if (vec[i].find(sep) != std::string::npos) {
27 for (std::string::const_iterator it = vec[i].begin();
28 it != vec[i].end(); ++it) {
29 if (*it == quote || *it == escape) {
30 out += escape, out += *it;
32 else if (*it ==
'\n') {
33 out += escape, out +=
'n';
35 else if (*it ==
'\r') {
36 out += escape, out +=
'r';
38 else if (*it ==
'\t') {
39 out += escape, out +=
't';
55 std::string
join_quoted(
const std::vector<std::string>& vec) {
std::string join_quoted(const std::vector< std::string > &vec, char sep, char quote, char escape)
Join a vector of strings using a separator character.