Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finance-oa
finance-manage
Commits
c3c49a05
Commit
c3c49a05
authored
Apr 16, 2022
by
XCSDN
Committed by
Gitee
Apr 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增一个取文件名而不带后缀的整合方法,干净又卫生啊兄弟们
parent
68a616d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
.../src/main/java/com/ruoyi/common/utils/file/FileUtils.java
+17
-1
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
View file @
c3c49a05
...
@@ -17,6 +17,7 @@ import com.ruoyi.common.config.RuoYiConfig;
...
@@ -17,6 +17,7 @@ import com.ruoyi.common.config.RuoYiConfig;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.uuid.IdUtils
;
import
com.ruoyi.common.utils.uuid.IdUtils
;
import
org.apache.commons.io.FilenameUtils
;
/**
/**
* 文件处理工具类
* 文件处理工具类
...
@@ -257,7 +258,7 @@ public class FileUtils
...
@@ -257,7 +258,7 @@ public class FileUtils
/**
/**
* 获取名称
* 获取名称
*
*
例如: /profile/upload/2022/04/16/ruoyi.png, 返回: ruoyi.png
* @param fileName 路径名称
* @param fileName 路径名称
* @return 没有文件路径的名称
* @return 没有文件路径的名称
*/
*/
...
@@ -272,4 +273,19 @@ public class FileUtils
...
@@ -272,4 +273,19 @@ public class FileUtils
int
index
=
Math
.
max
(
lastUnixPos
,
lastWindowsPos
);
int
index
=
Math
.
max
(
lastUnixPos
,
lastWindowsPos
);
return
fileName
.
substring
(
index
+
1
);
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
Markdown
is supported
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