summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-08-26 16:57:05 +0300
committerAndrei Karas <akaras@inbox.ru>2011-08-27 05:37:27 +0300
commit12bf548533867a2eb3a1c354b778ef7f9157322a (patch)
tree3cb6f61396f00a5d3fa280ecd9d99f309f06f4ca /src/utils/stringutils.cpp
parent2e7bfc350d38e16b3d340f8e4ea69e6ff6748f5c (diff)
downloadmv-12bf548533867a2eb3a1c354b778ef7f9157322a.tar.gz
mv-12bf548533867a2eb3a1c354b778ef7f9157322a.tar.bz2
mv-12bf548533867a2eb3a1c354b778ef7f9157322a.tar.xz
mv-12bf548533867a2eb3a1c354b778ef7f9157322a.zip
Basic support for guild bot integration.
Not working context menu actions, chat commands, auto complete.
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 0243c4315..317d88f2d 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -524,3 +524,57 @@ void deleteCharLeft(std::string &str, unsigned *pos)
break;
}
}
+
+bool findLast(std::string &str1, std::string str2)
+{
+ const unsigned s1 = str1.size();
+ const unsigned s2 = str2.size();
+ if (s1 < s2)
+ return false;
+ std::string tmp = str1.substr(s1 - s2);
+ if (tmp == str2)
+ return true;
+ return false;
+}
+
+bool findFirst(std::string &str1, std::string str2)
+{
+ const unsigned s1 = str1.size();
+ const unsigned s2 = str2.size();
+ if (s1 < s2)
+ return false;
+ std::string tmp = str1.substr(0, s2);
+ if (tmp == str2)
+ return true;
+ return false;
+}
+
+bool findCutLast(std::string &str1, std::string str2)
+{
+ const unsigned s1 = str1.size();
+ const unsigned s2 = str2.size();
+ if (s1 < s2)
+ return false;
+ std::string tmp = str1.substr(s1 - s2);
+ if (tmp == str2)
+ {
+ str1 = str1.substr(0, s1 - s2);
+ return true;
+ }
+ return false;
+}
+
+bool findCutFirst(std::string &str1, std::string str2)
+{
+ const unsigned s1 = str1.size();
+ const unsigned s2 = str2.size();
+ if (s1 < s2)
+ return false;
+ std::string tmp = str1.substr(0, s2);
+ if (tmp == str2)
+ {
+ str1 = str1.substr(s2);
+ return true;
+ }
+ return false;
+}