Java之获取文件名、文件类型(文件后缀名)
2019-10-16 本文已影响0人
codewhy
public class TestSubString {
public static void main(String[] args) {
String fileName = "upload/20191015/20191015163150_840.pdf";
String filePath = fileName.replace("/", "\\");
String docOldName = filePath.substring(filePath.lastIndexOf("\\") + 1);
System.out.println(docOldName);
}
}