//根据文件路径截取文件名 public String getfileName(String s) throws Exception{ s.trim(); String fileName = s.substring(s.lastIndexOf("/")+1); //或者 String fileName = s.substring(s.lastIndexOf("\\")+1); System.out.println("fileName = " + fileName); return fileName; }
参考文章:
http://rogerfederer.iteye.com/blog/1039666
本文出自 “一无所有-天行者” 博客,请务必保留此出处http://tianxingzhe.blog.51cto.com/3390077/1679695
原文地址:http://tianxingzhe.blog.51cto.com/3390077/1679695