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

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