| 5 | #include <string> |
| 6 | |
| 7 | std::string strjoin(const std::vector<std::string>& strings, const std::string& delim) { |
| 8 | // Empty input vector |
| 9 | if (strings.empty()) { |
| 10 | return ""; |
| 11 | } |
| 12 | |
| 13 | std::string output = strings[0]; |
| 14 | for (unsigned int i = 1; i < strings.size(); i++) { |
| 15 | output += format("%s%s", delim.c_str(), strings[i].c_str()); |
| 16 | } |
| 17 | return output; |
| 18 | } |
| 19 | |
| 20 | std::vector<std::string> strsplit(const std::string& s, char del) { |
| 21 | std::vector<std::string> v; |