Skip to content

string_view read_until(string_view&, sep) #4

@OlafvdSpek

Description

@OlafvdSpek
inline std::string_view read_until(std::string_view& v, char sep)
{
	size_t i = v.find(sep);
	std::string_view ret = v.substr(0, i);
	v.remove_prefix(i == std::string_view::npos ? i : i + 1);
	return ret;
}

I find it quite useful, perhaps it could be added to the library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions