#include <sstream>
#include <vector>
std::vector<std::string> split(const std::string& s, const char delim){
std::vector<std::string> res;
std::string item;
std:stringstream ss(s);
while(std::getline(ss, item, delim)) {
if(!item.empty()) res.push_back(item);
}
return res;
}
that's too much job from Java's split, no mention the powerful regex based split in Perl.
No comments:
Post a Comment