From 56092db23f41123e2d24c7a1d79608d663297733 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 17 五月 2024 18:22:53 +0800
Subject: [PATCH] bug修复

---
 common/StringUtil.h |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/common/StringUtil.h b/common/StringUtil.h
index 75d8d45..dfc701e 100644
--- a/common/StringUtil.h
+++ b/common/StringUtil.h
@@ -6,6 +6,7 @@
 #include <iostream>
 #include <sstream>
 #include <iomanip>
+#include <vector>
 using namespace std;
 
 class StringUtil {
@@ -65,4 +66,22 @@
 		oss << std::fixed << std::setprecision(precision) << value;
 		return oss.str();
 	}
+
+	static std::vector<std::string> split(std::string str, std::string pattern) {
+		std::string::size_type pos;
+		std::vector<std::string> result;
+		str += pattern;//扩展字符串以方便操作
+		int size = str.size();
+		for (int i = 0; i < size; i++)
+		{
+			pos = str.find(pattern, i);
+			if (pos < size)
+			{
+				std::string s = str.substr(i, pos - i);
+				result.push_back(s);
+				i = pos + pattern.size() - 1;
+			}
+		}
+		return result;
+	}
 };
\ No newline at end of file

--
Gitblit v1.8.0