util::Split

Split overloads

Synopses

Declared in <util/string.h>

Split a string on every instance of sep, returning a vector.

template<typename T = std::span<char const>>
std::vector<T>
Split(
    std::span<char const> const& sp,
    char sep,
    bool include_sep = false);
» more...

Split a string on any char found in separators, returning a vector.

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);
» more...

Return Value

  • The pieces of sp between occurrences of sep.
  • The pieces of sp between separators.

Parameters

NameDescription
sp [in]The input character range to split.
sep [in]Single character that splits the input.
include_sep [in]Whether to include the separator at the end of the left side of the splits.
separators [in]Set of characters, any of which splits the input.