add contains method

This commit is contained in:
Looly 2020-01-11 09:17:51 +08:00
parent a6b311a6d0
commit a10a57b236
2 changed files with 16 additions and 0 deletions

View File

@ -14,6 +14,7 @@
* 【all 】 修正equals避免可能存在的空指针问题pr#692@Github
* 【core 】 提供一个自带默认值的Mappr#87@Gitee
* 【core 】 修改Dict在非大小写敏感状态下get也不区分大小写issue#722@Github
* 【core 】 StrUtil增加contains方法issue#716@Github
### Bug修复
* 【core 】 修复NumberUtil.mul中null的结果错误问题issue#I17Y4J@Gitee

View File

@ -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);
}
/**
* 查找指定字符串是否包含指定字符串列表中的任意一个字符串
*