Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Basic method taken from http://stackoverflow.com/a/236803
- std::vector<std::string> split(const std::string& val, const char c, const int flags)
- {
- std::vector<std::string> res;
- std::stringstream ss;
- ss.str(val);
- std::string item;
- while(std::getline(ss, item, c)) {
- if(flags & STRIP_SPACES) {
- boost::trim(item);
- }
- if(!(flags & REMOVE_EMPTY) || !item.empty()) {
- res.push_back(std::move(item));
- }
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement