From 1199b187daa65b762d2f6b681d54e9aac2780783 Mon Sep 17 00:00:00 2001 From: pjungeblut Date: Tue, 25 Nov 2014 20:57:41 +0100 Subject: Eingabehilfe für Zeilenweise-Eingabe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- convenience/split.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 convenience/split.cpp (limited to 'convenience/split.cpp') 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 split(string &s, string delim) { //zerlegt s anhand aller Zeichen in delim + vector 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 -- cgit v1.2.3