该方法的作用,旨在:在longStr中找str,根据所传的theIndex来返回str在longStr中的第几个索引的字符串位置:
private int getIndexOfStrInLongStr(String longStr,String Str,int theIndex){
Set<Integer> indexInt = new LinkedHashSet<>();
int indexStr = 0;
int index = 0;
if(StringUtils.isNotEmpty(longStr)){
while (index != longStr.length()){
indexStr = longStr.indexOf(Str,index);
indexInt.add(indexStr);
if(indexInt.size() < theIndex){
index++;
}else {
break;
}
}
}else {
logger.error("本次需要获取的母字符串为空!");
}
return indexStr;
}