Is there a new Java 8 way of retrieving the file extension?

后端 未结 5 1933
闹比i
闹比i 2021-02-07 06:21

What I did up until now is following:

String fileName = \"file.date.txt\";
String ext = fileName.substring(fileName.lastIndexOf(\'.\') + 1);

System.out.printf(\         


        
5条回答
提交回复
热议问题