String还定义有lastIndexOf(String str,int from) 意思为str在字符串多次出现时将返回最后一次出现的位置。

eg: String str = "I can because i think i can";

        int index = str.lastIndexOf("can")

        System.out.println(index); // 24

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
猜你喜欢
  • 2021-11-26
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2021-09-15
相关资源
相似解决方案