aboutsummaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorjacopograndi <jacopo.grandi@outlook.it>2022-01-06 14:48:03 +0100
committerjacopograndi <jacopo.grandi@outlook.it>2022-01-06 14:48:03 +0100
commit33c54ee847b571a4b465a31f70dbf816e8f20fd5 (patch)
treec45e3bc3caf401f6c570ee7936b06a996054f71d /utils.h
parentd1f78cb99a94798bcd0383848bf46063e3338268 (diff)
day05
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils.h b/utils.h
new file mode 100644
index 0000000..f713da8
--- /dev/null
+++ b/utils.h
@@ -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