Guest User

Untitled

a guest
Nov 17th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. std::string trim( const std::string & str ){
  2. std::string::size_type startPos = str.find_first_not_of( " " );
  3. if( startPos != std::string::npos ){
  4. std::string::size_type endPos = str.find_last_of( " " );
  5. return ( endPos == std::string::npos ) ? str.substr( startPos ) : str.substr( startPos, endPos - startPos );
  6. }
  7. return str;
  8. }
Add Comment
Please, Sign In to add comment