Skip to content

Instantly share code, notes, and snippets.

View yuya-oc's full-sized avatar
👨‍💻

Yuya Ochiai yuya-oc

👨‍💻
View GitHub Profile
@shnya
shnya / C++ split: find version
Created December 9, 2010 18:01
C++ split: find version
vector<string> split(const string &str, const string &delim){
vector<string> res;
size_t current = 0, found, delimlen = delim.size();
while((found = str.find(delim, current)) != string::npos){
res.push_back(string(str, current, found - current));
current = found + delimlen;
}
res.push_back(string(str, current, str.size() - current));
return res;
}