summaryrefslogtreecommitdiff
path: root/other/split.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'other/split.cpp')
-rw-r--r--other/split.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/other/split.cpp b/other/split.cpp
new file mode 100644
index 0000000..ea7d5ff
--- /dev/null
+++ b/other/split.cpp
@@ -0,0 +1,9 @@
+vector<string> split(string &s, string delim) { // Zerlegt s anhand aller Zeichen in delim.
+ vector<string> result; char *token;
+ token = strtok((char*)s.c_str(), (char*)delim.c_str());
+ while (token != NULL) {
+ result.push_back(string(token));
+ token = strtok(NULL, (char*)delim.c_str());
+ }
+ return result;
+} \ No newline at end of file