Refactored #7 out into class files like I should have to begin with.

This commit is contained in:
2022-12-08 23:17:56 -05:00
parent 7ef32aafcb
commit 2139a01252
7 changed files with 155 additions and 106 deletions

22
2022/7/SplitStr.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef ADVENT_DVEREB_SPLITSTR_H
#define ADVENT_DVEREB_SPLITSTR_H
#include <vector>
#include <string>
std::vector<std::string> SplitStr(std::string str, const std::string &delim)
{
std::vector<std::string> rtn;
for(auto split = str.find(delim); split != std::string::npos; split = str.find(delim))
{
rtn.push_back(str.substr(0, split));
str = str.substr(split + delim.size()); // chop off beginning
}
if(str.size())
rtn.push_back(str);
return rtn;
}
#endif