diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-05-06 22:32:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-05-07 18:24:47 +0300 |
commit | 2a4649185cda0788444452168ddcf665af7f17b5 (patch) | |
tree | 5ef92bdda9421130873a08e7793fad40364b41e3 /src/utils/stringutils.cpp | |
parent | c371ce29dd114121fe0071e59460a9f197da70f5 (diff) | |
download | manaplus-2a4649185cda0788444452168ddcf665af7f17b5.tar.gz manaplus-2a4649185cda0788444452168ddcf665af7f17b5.tar.bz2 manaplus-2a4649185cda0788444452168ddcf665af7f17b5.tar.xz manaplus-2a4649185cda0788444452168ddcf665af7f17b5.zip |
Save atack filter between restarts.
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, '|'); +} |