vector split_with_string(const string& str, const string& delim) { vector substr_vt; int where_delim; int old_offset = 0; string temp; while((where_delim = str.find(delim, old_offset)) != string::npos) { temp.assign(str, old_offset, where_delim - old_offset); if (!(temp.empty())) { substr_vt.push_back(temp); } old_offset = where_delim + delim.length(); where_delim = old_offset; } temp.assign(str, old_offset, str.length() - old_offset); if (!(temp.empty())) { substr_vt.push_back(temp); } return substr_vt; }