/**
* 统计con在str中出现的次数
* @param str 原字符串
* @param con 子字符串
* @return 出次次数
*/
public static int numberOfStr(String str, String con){
if (str.endsWith(con)){
return str.split(con).length;
}else{
return str.split(con).length-1;
}
}
统计字符串出现的次数
最新推荐文章于 2023-05-08 18:12:12 发布