summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-13 16:43:37 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-13 16:43:37 +0300
commitc6204f4b682288b882c2d035381f5bacbe5820c5 (patch)
tree8fdb1ecbf35024fa8710fd1d472a75c3f5154d5f /src/utils
parentc7833cb8a08cf705e9e67124d746f6f7af2e93c3 (diff)
downloadmv-c6204f4b682288b882c2d035381f5bacbe5820c5.tar.gz
mv-c6204f4b682288b882c2d035381f5bacbe5820c5.tar.bz2
mv-c6204f4b682288b882c2d035381f5bacbe5820c5.tar.xz
mv-c6204f4b682288b882c2d035381f5bacbe5820c5.zip
Improve /invtostorage chat command.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp10
-rw-r--r--src/utils/stringutils.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index b308a5abe..6dd11160b 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -761,3 +761,13 @@ uint32_t parseNumber(const std::string &str)
i = atoi(str.c_str());
return i;
}
+
+std::string removeToken(std::string &str, const std::string &token)
+{
+ int idx = str.find(token);
+ if (idx > 0)
+ str = str.substr(idx + 1);
+ else
+ str.clear();
+ return str;
+}
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 25dcf9a9d..fa26bf44f 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -242,4 +242,6 @@ bool parse2Int(const std::string &args, int &x, int &y);
uint32_t parseNumber(const std::string &str);
+std::string removeToken(std::string &str, const std::string &token);
+
#endif // UTILS_STRINGUTILS_H