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

Synopsis

Declared in <util/string.h>

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

Description

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)"}.

Return Value

The pieces of sp between occurrences of sep.

Parameters

Name

Description

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.

Created with MrDocs