Skip to content

Instantly share code, notes, and snippets.

@rocarvaj
Created July 25, 2012 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rocarvaj/3178214 to your computer and use it in GitHub Desktop.
Save rocarvaj/3178214 to your computer and use it in GitHub Desktop.
C++ string chomp
string::size_type pos = str.find_last_not_of("\n \t");
if(pos != string::npos)
str = str.substr(0, pos+1);
@cybersmyth
Copy link

I forked a callable version, thanks for your work on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment