From dbf59a218edd684f93f9cf74cdddd6bebefe15e7 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Fri, 16 Jan 2015 00:42:45 +0100 Subject: Added Utils::split function for splitting strings at a delimiter --- src/core/common/Utils.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/core/common/Utils.hpp') diff --git a/src/core/common/Utils.hpp b/src/core/common/Utils.hpp index 5332b50..1f7f142 100644 --- a/src/core/common/Utils.hpp +++ b/src/core/common/Utils.hpp @@ -21,6 +21,7 @@ #include #include +#include namespace ousia { @@ -103,6 +104,16 @@ public: res << end; return res.str(); } + + /** + * Splits the given string at the delimiter and returns an array of + * substrings without the delimiter. + * + * @param s is the string that should be splitted. + * @param delim is the delimiter at which the string should be splitted. + * @return a vector of strings containing the splitted sub-strings. + */ + static std::vector split(const std::string &s, char delim); }; } -- cgit v1.2.3