梦想起航

人生没有等出来的美丽,只有走出来的辉煌!~

导航

Java中截取文件名不要后缀

例如:
File f = new File("d:/d/abc.txt");
f.getName()获得的是abc.txt,如果不需要后缀.txt,只要abc可以这样做:

String test = f.getName().substring(0,f.getName().lastIndexOf("."));

posted on 2012-11-13 18:47  梦想hust起航  阅读(3015)  评论(0编辑  收藏  举报