/**
* 查找词在某个字符串中的所有索引位置
* @param word
* @param str
* @return
*/
public static List<Integer> wordIndexes(String word,String str){
List<Integer> indexes = new ArrayList<>();
//word前字符串长度
int frontLength = 0;
while(str.contains(word)){
int index = str.indexOf(word);
//匹配word位置
indexes.add(index + frontLength);
frontLength += (index + word.length());
str = str.substring(index + word.length());//截取
}
return indexes;
}