summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp13
-rw-r--r--src/utils/stringutils.h4
2 files changed, 15 insertions, 2 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 5e45b6168..dffec3f0c 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -474,7 +474,18 @@ std::string packList(std::list<std::string> &list)
return str;
}
-std::list<std::string> unpackList(const std::string str)
+std::list<std::string> unpackList(const std::string &str)
{
return splitToStringList(str, '|');
}
+
+std::string stringToHexPath(const std::string &str)
+{
+ if (str.empty())
+ return "";
+
+ std::string hex = strprintf("%%%2x/", (int)str[0]);
+ for (unsigned f = 1; f < str.size(); f ++)
+ hex += strprintf("%%%2x", (int)str[f]);
+ return hex;
+}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 9d22f8ba8..796df92c5 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -182,6 +182,8 @@ std::vector<std::string> getLang();
std::string packList(std::list<std::string> &list);
-std::list<std::string> unpackList(const std::string str);
+std::list<std::string> unpackList(const std::string &str);
+
+std::string stringToHexPath(const std::string &str);
#endif // UTILS_STRINGUTILS_H