diff options
Diffstat (limited to 'frontend/strings.cpp')
| -rw-r--r-- | frontend/strings.cpp | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/frontend/strings.cpp b/frontend/strings.cpp index 70fed85..687309d 100644 --- a/frontend/strings.cpp +++ b/frontend/strings.cpp @@ -58,3 +58,16 @@ string str_title(const string & input) {  	return out;  } +string str_consume_arg(string & argv) { +	const char * delim = " \t"; +	size_t start = argv.find_first_not_of(delim); +	if (start == string::npos) start = 0; +	size_t end = argv.find_first_of(delim, start); +	if (end == string::npos) end = argv.size(); +	string out = argv.substr(start, end - start); +	size_t nextarg = argv.find_first_not_of(delim, end); +	if (nextarg == string::npos) nextarg = end; +	argv = argv.substr(nextarg); +	return out; +} + |