summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
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