void split(const std::string& str, const std::string& strDelimiter, std::vector<std::string>& result) { std::regex reg(strDelimiter); std::sregex_token_iterator pos(str.begin(), str.end(), reg, -1); decltype(pos) end; result.clear(); for (; pos != end; ++pos) { result.emplace_back(pos->str()); } }
void trim(std::string& s) { s.erase(0, s.find_first_not_of(' ')); s.erase(s.find_last_not_of(' ') + 1); }