public class Test02 {
public static int[] outPutNum(String str,String []s){
int times[]=new int[s.length];
int index=0;
for (int i = 0; i < s.length; i++) {
String string=str;
while (index!=-1) {
index=string.indexOf(s[i]);
if((index+s[i].length())!=string.length())
{
string=string.substring((index+s[i].length()),string.length());
if(index!=-1)
times[i]++;
}
else {
times[i]++;
index=-1;
}
}
index=0;
}
return times;
}
java判断小字符串在长字符串中出现次数
猜你喜欢
转载自blog.csdn.net/qq_42866384/article/details/81514411
今日推荐
周排行