/** * 获取文件扩展名 * @return */ public static String ext(String filename) { int index = filename.lastIndexOf("."); if (index == -1) { return null; } String result = filename.substring(index + 1); return result; }