插卡式饮水机:jsp或者JAVA如何获取文件的后缀名字吗?

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/04 21:57:00
比如说已经知道文件名为dddd.jpg了,怎么把文件名和后缀名字分开 ?望指教!希望给个成功的实例~

public String getFileType(String fileUri){
File file = new File(fileUri);
String fineName = file.getName();
String fileType = fileName.substring(fileName.lastIndexOf(\".\")+1,fileName.length())
return fileType;
}