|
@@ -44,6 +44,21 @@ public class FileUtil {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取文件名(包含后缀名)
|
|
|
+ */
|
|
|
+ public static String getFileName(String filePath) {
|
|
|
+ if (filePath == null) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ filePath = filePath.replace("\\", "/");
|
|
|
+ int index = filePath.lastIndexOf("/");
|
|
|
+ if (index > -1) {
|
|
|
+ return filePath.substring(index + 1);
|
|
|
+ }
|
|
|
+ return filePath;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取文件后缀名,包括"."
|
|
|
*/
|