public static String getPicSuffix(String img_path){ if (img_path == null || img_path.indexOf(".") == -1){ return ""; //如果图片地址为null或者地址中没有"."就返回"" } return img_path.substring(img_path.lastIndexOf(".") + 1). trim().toLowerCase(); }