Last active
December 11, 2015 13:39
-
-
Save whyrusleeping/4609397 to your computer and use it in GitHub Desktop.
my go to function for splitting a string into a vector of strings
This file contains hidden or 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
vector<string> oGlModel::splitString(string s, char delim) | |
{ | |
vector<string> retTok; | |
int beg=0,end=0; | |
for(int end = 0; end < s.length(); end++) | |
{ | |
if(s[end] == delim) | |
{ | |
retTok.push_back(s.substr(beg,end-beg)); | |
end++; | |
beg = end; | |
} | |
} | |
retTok.push_back(s.substr(end)); | |
return retTok; | |
} |
Algorithm Revision 2: 15.414, 15.203, 15.486
Algorithm Revision 3: 4.574, 4.559, 4.657
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
454,000,000 byte file:
Algorithm Revision 1: 17.886, 12.984, 13.041