Skip to content

Instantly share code, notes, and snippets.

@frenchie4111
Created May 11, 2014 20:59
Show Gist options
  • Save frenchie4111/b08eb418dd6c840c0e87 to your computer and use it in GitHub Desktop.
Save frenchie4111/b08eb418dd6c840c0e87 to your computer and use it in GitHub Desktop.
Remove Spaces
void remove_spaces( string *s ) {
while( isspace( s->c_str()[0] ) ) {
s->erase(0,1);
}
}
int main() {
string s = "\t\tHello World";
cout << "Before: " << s << endl;
remove_spaces( &s );
cout << "After: " << s << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment