Commit e75c0e68 authored by Dominik Charousset's avatar Dominik Charousset

Add missing split overloads

parent 3c36954c
...@@ -46,6 +46,12 @@ void split(std::vector<std::string>& result, string_view str, ...@@ -46,6 +46,12 @@ void split(std::vector<std::string>& result, string_view str,
void split(std::vector<string_view>& result, string_view str, void split(std::vector<string_view>& result, string_view str,
string_view delims, bool keep_all = true); string_view delims, bool keep_all = true);
void split(std::vector<std::string>& result, string_view str,
char delim, bool keep_all = true);
void split(std::vector<string_view>& result, string_view str,
char delim, bool keep_all = true);
template <class InputIterator> template <class InputIterator>
std::string join(InputIterator first, InputIterator last, string_view glue) { std::string join(InputIterator first, InputIterator last, string_view glue) {
if (first == last) if (first == last)
......
...@@ -56,6 +56,16 @@ void split(std::vector<string_view>& result, string_view str, ...@@ -56,6 +56,16 @@ void split(std::vector<string_view>& result, string_view str,
return split_impl(f, str, delims, keep_all); return split_impl(f, str, delims, keep_all);
} }
void split(std::vector<std::string>& result, string_view str, char delim,
bool keep_all) {
split(result, str, string_view{&delim, 1}, keep_all);
}
void split(std::vector<string_view>& result, string_view str, char delim,
bool keep_all) {
split(result, str, string_view{&delim, 1}, keep_all);
}
void replace_all(std::string& str, string_view what, string_view with) { void replace_all(std::string& str, string_view what, string_view with) {
// end(what) - 1 points to the null-terminator // end(what) - 1 points to the null-terminator
auto next = [&](std::string::iterator pos) -> std::string::iterator { auto next = [&](std::string::iterator pos) -> std::string::iterator {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment