diff options
Diffstat (limited to 'convenience')
| -rw-r--r-- | convenience/convenience.tex | 4 | ||||
| -rw-r--r-- | convenience/split.cpp | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/convenience/convenience.tex b/convenience/convenience.tex new file mode 100644 index 0000000..7871efd --- /dev/null +++ b/convenience/convenience.tex @@ -0,0 +1,4 @@ +\section{Convenience-Methoden} + +\subsection{Zeileneingabe} +\lstinputlisting{convenience/split.cpp}
\ No newline at end of file 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 |
