summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp11
-rw-r--r--src/utils/stringutils.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 99316ce32..357938fb8 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -375,3 +375,14 @@ std::set<int> splitToIntSet(const std::string &text, char separator)
return tokens;
}
+
+std::list<int> splitToIntList(const std::string &text, char separator)
+{
+ std::list<int> tokens;
+ std::stringstream ss(text);
+ std::string item;
+ while(std::getline(ss, item, separator))
+ tokens.push_back(atoi(item.c_str()));
+
+ return tokens;
+}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 934c0f82d..a69d30914 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -167,4 +167,6 @@ std::string normalize(const std::string &name);
std::set<int> splitToIntSet(const std::string &text, char separator);
+std::list<int> splitToIntList(const std::string &text, char separator);
+
#endif // UTILS_STRINGUTILS_H