Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
RuoYi Vue
Commits
0c820b96
Unverified
Commit
0c820b96
authored
Apr 16, 2022
by
若依
Committed by
Gitee
Apr 16, 2022
Browse files
!471 新增一个取文件名而不带后缀的整合方法,干净又卫生啊兄弟们
Merge pull request !471 from XCSDN/N/A
parents
68a616d7
c3c49a05
Changes
1
Hide whitespace changes
Inline
Side-by-side
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
View file @
0c820b96
...
...
@@ -17,6 +17,7 @@ import com.ruoyi.common.config.RuoYiConfig;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.uuid.IdUtils
;
import
org.apache.commons.io.FilenameUtils
;
/**
* 文件处理工具类
...
...
@@ -257,7 +258,7 @@ public class FileUtils
/**
* 获取名称
*
*
例如: /profile/upload/2022/04/16/ruoyi.png, 返回: ruoyi.png
* @param fileName 路径名称
* @return 没有文件路径的名称
*/
...
...
@@ -272,4 +273,19 @@ public class FileUtils
int
index
=
Math
.
max
(
lastUnixPos
,
lastWindowsPos
);
return
fileName
.
substring
(
index
+
1
);
}
/**
* 获取名称
* 例如: /profile/upload/2022/04/16/ruoyi.png, 返回: ruoyi
* @param fileName 路径名称
* @return 没有文件路径的名称
*/
public
static
String
getNameNotSuffix
(
String
fileName
)
{
if
(
fileName
==
null
)
{
return
null
;
}
String
baseName
=
FilenameUtils
.
getBaseName
(
fileName
);
return
baseName
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment