Java获取文件后缀

1 File file = new File("config.ini");
2 String suffix = file.getName().substring(file.getName().lastIndexOf(".") + 1);
3 if(suffix.equals("ini")) {
4     //true
5 }  else {
6     //false
7 }

猜你喜欢

转载自www.cnblogs.com/malinzhai/p/12613355.html