2024-05-31 22:59:00 -04:00
|
|
|
#ifndef RFL_INTERNAL_STRINGS_JOIN_HPP_
|
|
|
|
#define RFL_INTERNAL_STRINGS_JOIN_HPP_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace rfl {
|
2024-06-08 14:10:59 -04:00
|
|
|
namespace internal {
|
|
|
|
namespace strings {
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
/// Joins a string using the delimiter
|
|
|
|
inline std::string join(const std::string& _delimiter,
|
|
|
|
const std::vector<std::string>& _strings) {
|
|
|
|
if (_strings.size() == 0) { return ""; }
|
|
|
|
auto res = _strings[0];
|
|
|
|
for (size_t i = 1; i < _strings.size(); ++i) {
|
|
|
|
res += _delimiter + _strings[i];
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
2024-05-31 22:59:00 -04:00
|
|
|
|
2024-06-08 14:10:59 -04:00
|
|
|
} // namespace strings
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace rfl
|
2024-05-31 22:59:00 -04:00
|
|
|
|
|
|
|
#endif
|