日期:2014-05-19 浏览次数:20906 次
String str="d:/123/456/789.txt"; System.out.println(str.substring(0,str.lastIndexOf("/"))); ------解决方案--------------------String result = "d:/123/456/789.txt".replaceAll("/[^/]+$","");