diff options
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index ffce9897e..99316ce32 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -364,3 +364,14 @@ std::string normalize(const std::string &name) std::string normalized = name; return toLower(trim(normalized)); } + +std::set<int> splitToIntSet(const std::string &text, char separator) +{ + std::set<int> tokens; + std::stringstream ss(text); + std::string item; + while(std::getline(ss, item, separator)) + tokens.insert(atoi(item.c_str())); + + return tokens; +} |