| 48 | } |
| 49 | |
| 50 | std::string join_strings(const std::vector<std::string>& strings, const std::string& token) { |
| 51 | if (strings.empty()) { |
| 52 | return ""; |
| 53 | } |
| 54 | |
| 55 | if (strings.size() == 1) { |
| 56 | return strings.at(0); |
| 57 | } |
| 58 | const auto& initialValue = strings.at(0); |
| 59 | return std::accumulate(strings.begin()+1, strings.end(), initialValue, |
| 60 | [token,initialValue](const std::string& s1, const std::string& s2) { |
| 61 | return s1 + token + s2; |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | /**** |
| 66 | * ################################################################## |
no test coverage detected