diff options
Diffstat (limited to 'include/str_utility.hpp')
-rw-r--r-- | include/str_utility.hpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/str_utility.hpp b/include/str_utility.hpp new file mode 100644 index 0000000000..39e1c82351 --- /dev/null +++ b/include/str_utility.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include <string> +#include <string_view> +#include <vector> + +namespace bmcweb +{ +// This is a naive replacement for boost::split until +// https://github.com/llvm/llvm-project/issues/40486 +// is resolved +inline void split(std::vector<std::string>& strings, std::string_view str, + char delim) +{ + size_t start = 0; + size_t end = 0; + while ((start = str.find_first_not_of(delim, end)) != std::string::npos) + { + end = str.find(delim, start); + strings.emplace_back(str.substr(start, end - start)); + } +} +} // namespace bmcweb |