Skip to content

Instantly share code, notes, and snippets.

@winni2k
Last active August 29, 2015 14:18
Show Gist options
  • Save winni2k/1ab7f30a1372260ba56f to your computer and use it in GitHub Desktop.
Save winni2k/1ab7f30a1372260ba56f to your computer and use it in GitHub Desktop.
Find end of first five cols
string::size_type p_last = str.find_first_not_of(" ", 0);
string::size_type p_curr = str.find_first_of(" ", p_last);
// seek to end of header columns (5)
for(int i = 0; i<4; ++i){
p_last = str.find_first_not_of(" ", p_curr);
p_curr = str.find_first_of(" ", p_last);
}
ss.str(line.substr(0, p_last + 1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment