50 inline std::vector<std::string>
split_string(
const std::string& str,
const char sep,
bool compact =
false) {
51 std::vector<std::string> tokens;
55 std::size_t nextpos = str.find_first_of(sep);
56 while (nextpos != std::string::npos) {
57 if (!compact || (nextpos - pos != 0)) {
58 tokens.push_back(str.substr(pos, nextpos - pos));
61 nextpos = str.find_first_of(sep, pos);
63 if (!compact || pos != str.size()) {
64 tokens.push_back(str.substr(pos));
79 inline std::vector<std::string>
split_string(
const std::string& str,
const char* sep,
bool compact =
false) {
80 std::vector<std::string> tokens;
84 std::size_t nextpos = str.find_first_of(sep);
85 while (nextpos != std::string::npos) {
86 if (!compact || (nextpos - pos != 0)) {
87 tokens.push_back(str.substr(pos, nextpos - pos));
90 nextpos = str.find_first_of(sep, pos);
92 if (!compact || pos != str.size()) {
93 tokens.push_back(str.substr(pos));