论坛首页 入门技术论坛

如何去除文件后缀名

浏览 4159 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-09-18  
File selectFile =new File("E:/xxx.zip");
String FileName=selectFile.getName();
System.out.println(FileName);

输出为:
xxx.zip

我想把后缀名去掉,如何处理!

效果:
xxx
   发表时间:2007-09-19  
string.substring()
0 请登录后投票
   发表时间:2007-09-19  
fileName = fileName.subsstring(0, fileName.lastIndexOf('.'));
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics