From 2e009841cab2a22be9bea4833b197446da4643b7 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: Sat, 09 Aug 2025 15:18:29 +0800
Subject: [PATCH] 自动识别json对象白名单配置范围缩小
---
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StringUtils.java | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StringUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StringUtils.java
index cc9f12b..a27ab62 100644
--- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StringUtils.java
+++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/StringUtils.java
@@ -284,6 +284,32 @@
}
/**
+ * 在字符串中查找第一个出现的 `open` 和最后一个出现的 `close` 之间的子字符串
+ *
+ * @param str 要截取的字符串
+ * @param open 起始字符串
+ * @param close 结束字符串
+ * @return 截取结果
+ */
+ public static String substringBetweenLast(final String str, final String open, final String close)
+ {
+ if (isEmpty(str) || isEmpty(open) || isEmpty(close))
+ {
+ return NULLSTR;
+ }
+ final int start = str.indexOf(open);
+ if (start != INDEX_NOT_FOUND)
+ {
+ final int end = str.lastIndexOf(close);
+ if (end != INDEX_NOT_FOUND)
+ {
+ return str.substring(start + open.length(), end);
+ }
+ }
+ return NULLSTR;
+ }
+
+ /**
* 判断是否为空,并且不是空白字符
*
* @param str 要判断的value
--
Gitblit v1.9.3