Merge pull request #926 from dahuoyzs/v5-dev

FileUtil重载方法,添加getSuffix方法✒️
This commit is contained in:
Golden Looly 2020-06-17 00:08:47 +08:00 committed by GitHub
commit 6a6dfa0e19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1847,6 +1847,46 @@ public class FileUtil {
return filePath.substring(begin, len); return filePath.substring(begin, len);
} }
/**
* 获取文件后缀名扩展名不带.
*
* @param file 文件
* @return 扩展名
*/
public static String getSuffix(File file) {
return extName(file);
}
/**
* 获得文件后缀名扩展名不带.
*
* @param fileName 文件名
* @return 扩展名
*/
public static String getSuffix(String fileName) {
return extName(fileName);
}
/**
* 返回主文件名
*
* @param file 文件
* @return 主文件名
*/
public static String getPrefix(File file) {
return mainName(file);
}
/**
* 返回主文件名
*
* @param fileName 完整文件名
* @return 主文件名
*/
public static String getPrefix(String fileName) {
return mainName(fileName);
}
/** /**
* 返回主文件名 * 返回主文件名
* *