获取文件后缀名类

时间:2021-09-13 12:13:53   收藏:0   阅读:22
public class GetFileExtUtil {
 
    /**
     * 获取文件扩展名
     * @param path 文件路径
     */
    public static String getExt(String path) {
        if (path == null || path.equals("") || !path.contains(".")) {
            return null;
        } else {
            return path.substring(path.lastIndexOf(".") + 1, path.length());
        }
    }
}

原文:https://www.cnblogs.com/codertl/p/15257946.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!