Skip to content

Commit 7b50c5e

Browse files
committed
update fileUtil
1 parent 4ed3530 commit 7b50c5e

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

util-lib/src/main/java/com/moioio/util/FileUtil.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,28 @@ public static String getSuffix(String path) {
190190
return path;
191191
}
192192

193+
// public static void main(String[] args)
194+
// {
195+
// MyLog.debug(getSuffix("E:\\tme\\album\\279085261\\5.wav"));
196+
// }
197+
198+
public static String getNameWithoutSuffix(String path) {
199+
200+
String name = new File(path).getName();
201+
int lastIndexOf = name.lastIndexOf(".");
202+
if(lastIndexOf!=-1)
203+
{
204+
name = name.substring(0,lastIndexOf);
205+
return name;
206+
}
207+
else
208+
{
209+
return name;
210+
}
211+
}
212+
213+
214+
193215
public static String getSuffixFromUrl(String url)
194216
{
195217
if (!StringUtil.isNull(url))

0 commit comments

Comments
 (0)