java获取文件后缀名(正则表达式)+文件名
String fileName="asadas.jsp"; String reg = ".+(.JPEG|.jpeg|.JPG|.jpg|.png|.PNG)$"; Matcher matcher =Pattern.compile(reg).matcher(fileName); System.out.println(matcher.find());
public String[] simpleFile (String file){ int sum = file.lastIndexOf("."); return new String[]{ file.substring(0, sum), file.substring(sum + 1) }; }