summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp21
-rw-r--r--src/utils/stringutils.h4
2 files changed, 24 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, '|');
+}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index f0dbf0bd9..9d22f8ba8 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -180,4 +180,8 @@ std::string combineDye2(std::string file, std::string dye);
std::vector<std::string> getLang();
+std::string packList(std::list<std::string> &list);
+
+std::list<std::string> unpackList(const std::string str);
+
#endif // UTILS_STRINGUTILS_H