Skip to content

Instantly share code, notes, and snippets.

@ilpropheta
Created January 1, 2017 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilpropheta/cbe87b69df98dc0fe5df4ad21fbb15ed to your computer and use it in GitHub Desktop.
Save ilpropheta/cbe87b69df98dc0fe5df4ad21fbb15ed to your computer and use it in GitHub Desktop.
string_view sv = name.GetString(); // GetString() returns a null-terminated const char*
sv.remove_prefix(std::min(v.find_first_not_of(" "), v.size())); // left trim
sv.remove_suffix(std::min(v.size()-v.find_last_not_of(" ")-1, v.size())); // right trim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment