diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-14 23:23:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-14 23:36:38 +0300 |
commit | bf9bccc30a186e338f96c230a4f63cc924c77bd8 (patch) | |
tree | e46dbc2f022842982d89164ee598e1bcf827aa39 /src/utils | |
parent | fb0f86589ae9e2d582383cea43e0a391e8d4739d (diff) | |
download | manaplus-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')
-rw-r--r-- | src/utils/stringutils.cpp | 13 | ||||
-rw-r--r-- | src/utils/stringutils.h | 4 |
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 |