* Return a String containing the vector **v** joined with **sep** * * If **v** is empty, the function returns an empty string * For each element in **v**, * it will concatenate this element and **sep** with result * * @param [in] v Vector to join as a String * @param [in] sep String used to join each element from **v** * @return empty string if **v** is empty or concatenated string **/
| 81 | * @return empty string if **v** is empty or concatenated string |
| 82 | **/ |
| 83 | inline std::string str_join(const std::vector<std::string>& v, const std::string& sep) |
| 84 | { |
| 85 | if (v.empty()) |
| 86 | return std::string(); |
| 87 | auto i = v.cbegin(); |
| 88 | std::string r = *i; |
| 89 | for (++i; i != v.cend(); ++i) { |
| 90 | r += sep; |
| 91 | r += *i; |
| 92 | } |
| 93 | return r; |
| 94 | } |
| 95 | |
| 96 | #endif |
no test coverage detected