📅  最后修改于: 2022-03-11 14:52:41.146000             🧑  作者: Mango
public static int ordinalIndexOf(String str, String substr, int n) {
int pos = str.indexOf(substr);
while (--n > 0 && pos != -1)
pos = str.indexOf(substr, pos + 1);
return pos;
}