summaryrefslogtreecommitdiff
path: root/ZAPD/Utils/StringHelper.h
diff options
context:
space:
mode:
authorAdam Bird <archez39@me.com>2024-05-03 01:51:24 -0400
committerAdam Bird <archez39@me.com>2024-05-03 01:51:24 -0400
commit4b6efa9c20a448e73949eda87864faa79ebbfb1b (patch)
tree47cc59cfa6ddcd778babb723bdc8d4975ee57145 /ZAPD/Utils/StringHelper.h
parentdcf264b8e8979a21756a13998af78f2d5a9672e1 (diff)
parent97f3ea6a7be5953d3514b7ce347c61cbe9b36d98 (diff)
Merge remote-tracking branch 'upstream/master' into merge-upstream
Diffstat (limited to 'ZAPD/Utils/StringHelper.h')
-rw-r--r--ZAPD/Utils/StringHelper.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/ZAPD/Utils/StringHelper.h b/ZAPD/Utils/StringHelper.h
new file mode 100644
index 0000000..0fc58d3
--- /dev/null
+++ b/ZAPD/Utils/StringHelper.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <algorithm>
+#include <cstdarg>
+#include <cstring>
+#include <numeric>
+#include <string>
+#include <string_view>
+#include <vector>
+#include <cstdint>
+
+class StringHelper
+{
+public:
+ static std::vector<std::string> Split(std::string s, const std::string& delimiter);
+ static std::vector<std::string_view> Split(std::string_view s, const std::string& delimiter);
+ static std::string Strip(std::string s, const std::string& delimiter);
+ static std::string Replace(std::string str, const std::string& from, const std::string& to);
+ static void ReplaceOriginal(std::string& str, const std::string& from, const std::string& to);
+ static bool StartsWith(const std::string& s, const std::string& input);
+ static bool Contains(const std::string& s, const std::string& input);
+ static bool EndsWith(const std::string& s, const std::string& input);
+ static std::string Sprintf(const char* format, ...);
+ static std::string Implode(std::vector<std::string>& elements, const char* const separator);
+ static int64_t StrToL(const std::string& str, int32_t base = 10);
+ static std::string BoolStr(bool b);
+ static bool HasOnlyDigits(const std::string& str);
+ static bool IsValidHex(std::string_view str);
+ static bool IsValidHex(const std::string& str);
+ static bool IsValidOffset(std::string_view str);
+ static bool IsValidOffset(const std::string& str);
+ static bool IEquals(const std::string& a, const std::string& b);
+}; \ No newline at end of file