diff options
| author | pjungeblut <paul.jungeblut@gmail.com> | 2014-11-25 20:57:41 +0100 |
|---|---|---|
| committer | pjungeblut <paul.jungeblut@gmail.com> | 2014-11-25 20:57:41 +0100 |
| commit | 1199b187daa65b762d2f6b681d54e9aac2780783 (patch) | |
| tree | 4ec1e619d9765603ebb180ee4a5d63024b917f7c /convenience/split.cpp | |
| parent | 1a91dadfeed24be8ceda8636795ad776c658bb88 (diff) | |
Eingabehilfe für Zeilenweise-Eingabe
Diffstat (limited to 'convenience/split.cpp')
| -rw-r--r-- | convenience/split.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/convenience/split.cpp b/convenience/split.cpp new file mode 100644 index 0000000..d7628f3 --- /dev/null +++ b/convenience/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 |
