Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string_view read_until(string_view&, sep) #4

Open
OlafvdSpek opened this issue Feb 5, 2017 · 0 comments
Open

string_view read_until(string_view&, sep) #4

OlafvdSpek opened this issue Feb 5, 2017 · 0 comments

Comments

@OlafvdSpek
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant