Merge pull request #1123 from akiyamaneko/patch-3

敏感词工具类SensitiveUtil支持自定义字符过滤规则
This commit is contained in:
Golden Looly 2020-09-27 09:33:28 +08:00 committed by GitHub
commit 3185664018
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,6 +72,18 @@ public final class SensitiveUtil {
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 文本