规则边缘的博客
- 最近
- 文章
- 资源
- 问答
- 课程
- 帖子
- 收藏
- 关注/订阅




像java自带的函数,不懂的话可以看看API文档。https://docs.oracle.com/javase/8/docs/api/。IDE里导入JDK源码,也能很方便的查看。
public int indexOf(String str, int fromIndex)
Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
The returned index is the smallest value k for which:
k >= fromIndex && this.startsWith(str, k)
If no such value of k exists, then -1 is returned.
Parameters:
str - the substring to search for.
fromIndex - the index from which to start the search.
Returns:
the index of the first occurrence of the specified substring, starting at the specified index, or -1 if there is no such occurrence.

回答了问题于 1 月前