summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils/stringutils.cpp18
-rw-r--r--src/utils/stringutils.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 13d6501da..d384ef28c 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -747,6 +747,24 @@ bool parse2Int(const std::string &args, int &x, int &y)
return isValid;
}
+bool parse2Str(const std::string &args, std::string &str1, std::string &str2)
+{
+ bool isValid = false;
+ size_t pos = args.find(" ");
+ if (pos == std::string::npos)
+ pos = args.find(",");
+ if (pos != std::string::npos)
+ {
+ if (pos + 1 < args.length())
+ {
+ str1 = args.substr(0, pos).c_str();
+ str2 = args.substr(pos + 1, args.length()).c_str();
+ isValid = true;
+ }
+ }
+ return isValid;
+}
+
uint32_t parseNumber(const std::string &str)
{
uint32_t i = 0;
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 3cca7c0f8..da75a42fa 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -240,6 +240,8 @@ void secureChatCommand(std::string &str);
bool parse2Int(const std::string &args, int &x, int &y);
+bool parse2Str(const std::string &args, std::string &str1, std::string &str2);
+
uint32_t parseNumber(const std::string &str);
std::string removeToken(std::string &str, const std::string &token);