Split a string on any char found in separators, returning a vector.
Declared in <util/string.h>
template<typename T = std::span<char const>>
std::vector<T>
Split(
std::span<char const> const& sp,
std::string_view separators,
bool include_sep = false);
If sep does not occur in sp, a singleton with the entirety of sp is returned.
Note that this function does not care about braces, so splitting "foo(bar(1),2),3) on ',' will return {"foo(bar(1)", "2)", "3)"}.
If include_sep == true, splitting "foo(bar(1),2),3) on ',' will return:
foo(bar(1),
2),
3)
The pieces of sp between separators.
| Name | Description |
|---|---|
| include_sep [in] | Whether to include the separator at the end of the left side of the splits. |
| sp [in] | The input character range to split. |
| separators [in] | Set of characters, any of which splits the input. |