java 截取文件名

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

原文地址:https://www.cnblogs.com/zjazn/p/14475026.html