mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-09 15:17:59 +08:00
Merge pull request #1123 from akiyamaneko/patch-3
敏感词工具类SensitiveUtil支持自定义字符过滤规则
This commit is contained in:
commit
3185664018
@ -72,6 +72,18 @@ public final class SensitiveUtil {
|
|||||||
init(sensitiveWords, DEFAULT_SEPARATOR, isAsync);
|
init(sensitiveWords, DEFAULT_SEPARATOR, isAsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置字符过滤规则,通过定义字符串过滤规则,过滤不需要的字符<br>
|
||||||
|
* 当accept为false时,此字符不参与匹配
|
||||||
|
*
|
||||||
|
* @param charFilter 过滤函数
|
||||||
|
*/
|
||||||
|
public static void setCharFilter(Filter<Character> charFilter) {
|
||||||
|
if(charFilter != null) {
|
||||||
|
sensitiveTree.setCharFilter(charFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否包含敏感词
|
* 是否包含敏感词
|
||||||
* @param text 文本
|
* @param text 文本
|
||||||
|
Loading…
Reference in New Issue
Block a user