mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-04 12:47:59 +08:00
add contains method
This commit is contained in:
parent
a6b311a6d0
commit
a10a57b236
@ -14,6 +14,7 @@
|
||||
* 【all 】 修正equals,避免可能存在的空指针问题(pr#692@Github)
|
||||
* 【core 】 提供一个自带默认值的Map(pr#87@Gitee)
|
||||
* 【core 】 修改Dict在非大小写敏感状态下get也不区分大小写(issue#722@Github)
|
||||
* 【core 】 StrUtil增加contains方法(issue#716@Github)
|
||||
|
||||
### Bug修复
|
||||
* 【core 】 修复NumberUtil.mul中null的结果错误问题(issue#I17Y4J@Gitee)
|
||||
|
@ -727,6 +727,21 @@ public class StrUtil {
|
||||
return indexOf(str, searchChar) > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定字符串是否在字符串中出现过
|
||||
*
|
||||
* @param str 字符串
|
||||
* @param searchStr 被查找的字符串
|
||||
* @return 是否包含
|
||||
* @since 5.1.1
|
||||
*/
|
||||
public static boolean contains(CharSequence str, CharSequence searchStr) {
|
||||
if(null == str || null == searchStr){
|
||||
return false;
|
||||
}
|
||||
return str.toString().contains(searchStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找指定字符串是否包含指定字符串列表中的任意一个字符串
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user