diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-02-27 18:08:34 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-02-27 23:26:17 +0200 |
commit | df5c7ae83a80db63ab90142df9e3a93f5ee630d0 (patch) | |
tree | 465991eb7785c1d17e1b15f6798efa67951a0c83 /src/utils | |
parent | 41e84157e0eca3a494cd6d44eec96dfbde0f5626 (diff) | |
download | plus-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.gz plus-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.bz2 plus-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.xz plus-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.zip |
First part of implimintation item colors.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/stringutils.cpp | 10 | ||||
-rw-r--r-- | src/utils/stringutils.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index d914efe30..835f9ce00 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -387,3 +387,13 @@ std::list<int> splitToIntList(const std::string &text, char separator) return tokens; } + +std::string combineDye(std::string file, std::string dye) +{ + if (dye.empty()) + return file; + size_t pos = file.find_last_of("|"); + if (pos != std::string::npos) + return file.substr(0, pos) + "|" + dye; + return file + "|" + dye; +} diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index ab16bb64b..52b47e6a2 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -170,4 +170,6 @@ std::set<int> splitToIntSet(const std::string &text, char separator); std::list<int> splitToIntList(const std::string &text, char separator); +std::string combineDye(std::string file, std::string dye); + #endif // UTILS_STRINGUTILS_H |