Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active June 30, 2024 14:24
Show Gist options
  • Save trikitrok/bd1db56add1c595cd762 to your computer and use it in GitHub Desktop.
Save trikitrok/bd1db56add1c595cd762 to your computer and use it in GitHub Desktop.
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <boost/regex.hpp>
std::vector<std::string> StringUtils::split(
const std::string & str,
const std::vector<std::string> & delimiters) {
std::vector<std::string> tokens;
boost::algorithm::split_regex(
tokens,
str,
boost::regex(
boost::join(escapeDelimiters(delimiters), "|"))
);
return tokens;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment