summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-14 23:23:30 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-14 23:36:38 +0300
commitbf9bccc30a186e338f96c230a4f63cc924c77bd8 (patch)
treee46dbc2f022842982d89164ee598e1bcf827aa39 /src/utils/stringutils.cpp
parentfb0f86589ae9e2d582383cea43e0a391e8d4739d (diff)
downloadmanaplus-bf9bccc30a186e338f96c230a4f63cc924c77bd8.tar.gz
manaplus-bf9bccc30a186e338f96c230a4f63cc924c77bd8.tar.bz2
manaplus-bf9bccc30a186e338f96c230a4f63cc924c77bd8.tar.xz
manaplus-bf9bccc30a186e338f96c230a4f63cc924c77bd8.zip
Add ability to add comments to any players.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp13
1 files changed, 12 insertions, 1 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;
+}