Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::string trim( const std::string & str ){
- std::string::size_type startPos = str.find_first_not_of( " " );
- if( startPos != std::string::npos ){
- std::string::size_type endPos = str.find_last_of( " " );
- return ( endPos == std::string::npos ) ? str.substr( startPos ) : str.substr( startPos, endPos - startPos );
- }
- return str;
- }
Add Comment
Please, Sign In to add comment