string_split的实现:
void string_split(const std::string &str, const std::string &sep,
std::vector<std::string> *strs, bool ignore_empty) {
if (strs == NULL) {
return ;
}
int start = 0;
std::string temp = "";
int found = str.find_first_of(sep, start);
while(found != std::string::npos) {
temp = str.substr(start, found - start);
if (!ignore_empty || temp != "") {
strs->push_back(temp);
}
start = found + 1;
found = str.find_first_of(sep, start);
}
temp = str.substr(start, str.size() - start);
if (!ignore_empty || temp != "") {
strs->push_back(temp);
}
}