From 849dd6438043c7cc96b92464685cc5f45bc72804 Mon Sep 17 00:00:00 2001 From: yds <11232266+yuds11@user.noreply.gitee.com> Date: Fri, 2 May 2025 22:48:50 +0800 Subject: [PATCH] =?UTF-8?q?issue110,=E5=B9=B6=E5=BA=9F=E9=99=A4=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E9=BB=91=E7=99=BD=E5=90=8D=E5=8D=95=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E9=81=8D=E5=8E=86=E6=97=B6=E7=9A=84=E5=86=97=E4=BD=99=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sensitive/word/support/check/WordCheckWord.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/houbb/sensitive/word/support/check/WordCheckWord.java b/src/main/java/com/github/houbb/sensitive/word/support/check/WordCheckWord.java index c3113de..a72abd6 100644 --- a/src/main/java/com/github/houbb/sensitive/word/support/check/WordCheckWord.java +++ b/src/main/java/com/github/houbb/sensitive/word/support/check/WordCheckWord.java @@ -9,6 +9,7 @@ import com.github.houbb.sensitive.word.api.context.InnerSensitiveWordContext; import com.github.houbb.sensitive.word.constant.enums.WordTypeEnum; import com.github.houbb.sensitive.word.constant.enums.WordContainsTypeEnum; import com.github.houbb.sensitive.word.support.result.WordLengthResult; +import com.github.houbb.sensitive.word.utils.InnerWordFormatUtils; import java.util.Map; @@ -90,9 +91,18 @@ public class WordCheckWord extends AbstractWordCheck { } } + String whiteWord = txt.substring(beginIndex, beginIndex + maxWhite); + String blackWord = txt.substring(beginIndex, beginIndex + maxBlack); + + String formatWhiteWord= InnerWordFormatUtils.format(whiteWord,context); + String formatBlackWord= InnerWordFormatUtils.format(blackWord,context); + + return WordLengthResult.newInstance() .wordAllowLen(maxWhite) - .wordDenyLen(maxBlack); + .wordDenyLen(maxBlack) + .wordAllow(formatWhiteWord) + .wordDeny(formatBlackWord); } @Override