mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
FileUtil重载方法,添加getSuffix方法✒️
This commit is contained in:
parent
3b80f0a3d1
commit
e1099dea28
@ -1847,6 +1847,46 @@ public class FileUtil {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回主文件名
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user