Created
July 25, 2012 19:57
-
-
Save rocarvaj/3178214 to your computer and use it in GitHub Desktop.
C++ string chomp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string::size_type pos = str.find_last_not_of("\n \t"); | |
if(pos != string::npos) | |
str = str.substr(0, pos+1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I forked a callable version, thanks for your work on this