Testing a syntax highlighting plugin…
std::vector<std::string> Util::split(const std::string& s, const std::string& delim, bool trim_spaces) { std::vector<std::string> result; if (delim.empty()) { result.push_back(s); return result; } std::string::const_iterator substart = s.begin(), subend; while (true) { subend = search(substart, s.end(), delim.begin(), delim.end()); std::string temp(substart, subend); result.push_back((trim_spaces) ? Util::trim(temp) : temp); if (subend == s.end()) { break; } substart = subend + delim.size(); } return result; }
Adding a comment