此方法返回此对象表示的字符序列中该字符最后一次出现的索引,该索引小于或等于fromIndex,如果没找到,则返回-1。
public int lastIndexOf(int ch, int fromIndex)
这是参数的详细信息-
链接:https://www.learnfk.comhttps://www.learnfk.com/java/java-string-lastindexof-chfromindex.html
来源:LearnFk无涯教程网
ch - 一个字符。
fromIndex - 从中开始搜索的索引。
import java.io.*; public class Test { public static void main(String args[]) { String Str=new String("Welcome to Learnfk.com"); System.out.print("Found Last Index :" ); System.out.println(Str.lastIndexOf( 'f', 5 )); } }
这将产生以下输出-
Found Last Index :4
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)
Spring Cloud 微服务项目实战 -〔姚秋辰(姚半仙)〕