vector<string> split_string(const string &in, char del, bool skip_empty) { vector<string> res; if (in.empty() || del == ‘\0‘) return res; string field; istringstream f(in); if (del == ‘\n‘) { while(getline(f, field)) { if (field.empty() && skip_empty) continue; res.push_back(field); } } else { while(getline(f, field, del)) { if (field.empty() && skip_empty) continue; res.push_back(field); } } return res; }