diff --git a/src/string.cpp b/src/string.cpp index 41abd3f..e2765a9 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -25,6 +25,13 @@ #include #include "string.h" +std::vector strsplitwords(const std::string& str, const std::string& delim) { + + std::vector words = strsplit(str, delim); + std::for_each(words.begin(), words.end(), trim); + return words; +} + std::vector strsplit(const std::string& str, const std::string& delim) { std::vector r; diff --git a/src/string.h b/src/string.h index e4ba6d5..2466878 100644 --- a/src/string.h +++ b/src/string.h @@ -27,6 +27,8 @@ #include #include +std::vector strsplitwords(const std::string& str, const std::string& delim = ","); + std::vector strsplit(const std::string& str, const std::string& delim); std::string& strtolower(std::string& str);