diff options
author | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-06 14:48:03 +0100 |
---|---|---|
committer | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-06 14:48:03 +0100 |
commit | 33c54ee847b571a4b465a31f70dbf816e8f20fd5 (patch) | |
tree | c45e3bc3caf401f6c570ee7936b06a996054f71d /utils.h | |
parent | d1f78cb99a94798bcd0383848bf46063e3338268 (diff) |
day05
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -0,0 +1,12 @@ +#ifndef UTILS_H +#define UTILS_H + +void split (std::vector<std::string> &vec, std::string str, std::string del) { + auto token = str.find(del); + if (token != std::string::npos) { + vec.push_back(str.substr(0, token)); + split(vec, str.substr(token+del.size()), del); + } else { vec.push_back(str); } +} + +#endif |