zhuangjie
ZhuangJie

String fileName = "abc.file.mp4";
String cStr=fileName.substring(0,fileName.lastIndexOf("."));  //substring() 可以截取索引范围内的字符串,而lastIndexOf(“.”) 可以从后面开始查找指定字符对应的索引。
System.out.println(cStr);

posted on 2021-03-03 16:01  zhuangjie  阅读(953)  评论(0)    收藏  举报