inline std::string_view trim( std::string_view str ){
	auto first = str.find_first_not_of( ' ' );
	auto last  = str.find_last_not_of(  ' ' );
	auto chars_removed = first + (str.size()-last-1);
	return str.substr( first, str.size() - chars_removed );
}
Beispiel #2
0
std::string_view trim(std::string_view str)
{
    str.remove_prefix(str.find_first_not_of(' '));
    str.remove_suffix(str.size() - (str.find_last_not_of(' ') + 1));
    return str;
}