如果你的项目已经依赖于Apache Commons StringUtils.ordinalIndexOf,则可以使用,否则,这里是一个实现:
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;}


