diff options
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index ea2d18276..d9eca557d 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -456,4 +456,23 @@ std::vector<std::string> getLang() if (dot != (signed)std::string::npos) langs.push_back(lang.substr(0, dot)); return langs; -}
\ No newline at end of file +} + +std::string packList(std::list<std::string> &list) +{ + std::list<std::string>::iterator i = list.begin(); + std::string str = ""; + while (i != list.end()) + { + str = str + (*i) + "|"; + ++ i; + } + if (str.size() > 1) + str = str.substr(0, str.size() - 1); + return str; +} + +std::list<std::string> unpackList(const std::string str) +{ + return splitToStringList(str, '|'); +} |