From 9d9f582738123dbbfc6a7b91bb16ff4e4bf9f8f2 Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Tue, 10 Feb 2026 13:51:13 +0800
Subject: [PATCH] 恢复日志展示
---
multi-common/src/main/java/com/gkhy/exam/common/utils/StringUtils.java | 92 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 92 insertions(+), 0 deletions(-)
diff --git a/multi-common/src/main/java/com/gkhy/exam/common/utils/StringUtils.java b/multi-common/src/main/java/com/gkhy/exam/common/utils/StringUtils.java
index e9ed52d..9776989 100644
--- a/multi-common/src/main/java/com/gkhy/exam/common/utils/StringUtils.java
+++ b/multi-common/src/main/java/com/gkhy/exam/common/utils/StringUtils.java
@@ -5,10 +5,13 @@
import org.springframework.util.AntPathMatcher;
import java.util.List;
+import java.util.Map;
import static org.apache.commons.lang3.StringUtils.startsWithAny;
public class StringUtils extends StrUtil {
+
+ private static final String NULLSTR = "";
/**
* 是否为http(s)://开头
@@ -78,4 +81,93 @@
return matcher.match(pattern, url);
}
+ /**
+ * 截取字符串
+ *
+ * @param str 字符串
+ * @param start 开始
+ * @param end 结束
+ * @return 结果
+ */
+ public static String substring(final String str, int start, int end)
+ {
+ if (str == null)
+ {
+ return NULLSTR;
+ }
+
+ if (end < 0)
+ {
+ end = str.length() + end;
+ }
+ if (start < 0)
+ {
+ start = str.length() + start;
+ }
+
+ if (end > str.length())
+ {
+ end = str.length();
+ }
+
+ if (start > end)
+ {
+ return NULLSTR;
+ }
+
+ if (start < 0)
+ {
+ start = 0;
+ }
+ if (end < 0)
+ {
+ end = 0;
+ }
+
+ return str.substring(start, end);
+ }
+
+ /**
+ * * 判断一个对象是否为空
+ *
+ * @param object Object
+ * @return true:为空 false:非空
+ */
+ public static boolean isNull(Object object)
+ {
+ return object == null;
+ }
+ /**
+ * * 判断一个对象是否非空
+ *
+ * @param object Object
+ * @return true:非空 false:空
+ */
+ public static boolean isNotNull(Object object)
+ {
+ return !isNull(object);
+ }
+
+ /**
+ * * 判断一个Map是否为空
+ *
+ * @param map 要判断的Map
+ * @return true:为空 false:非空
+ */
+ public static boolean isEmpty(Map<?, ?> map)
+ {
+ return isNull(map) || map.isEmpty();
+ }
+
+ /**
+ * * 判断一个Map是否为空
+ *
+ * @param map 要判断的Map
+ * @return true:非空 false:空
+ */
+ public static boolean isNotEmpty(Map<?, ?> map)
+ {
+ return !isEmpty(map);
+ }
+
}
--
Gitblit v1.9.2