public static String renamePath(String path, String newName) {
        if (!Strings.isBlank(path)) {
            int pos = path.replace('\\', '/').lastIndexOf('/');
            if (pos > 0)
                return path.substring(0, pos) + "/" + newName;
        }
        return newName;
    }
public static String renamePath(String path, String newName) {
        if (!Strings.isBlank(path)) {
            int pos = path.replace('\\', '/').lastIndexOf('/');
            if (pos > 0)
                return path.substring(0, pos) + "/" + newName;
        }
        return newName;
    }
public static String renamePath ( String path , String newName ) { if ( ! Strings . isBlank ( path ) ) { int pos = path . replace ( ' ' , ' ' ) . lastIndexOf ( ' ' ) ; if ( pos > 0 ) return path . substring ( 0 , pos ) + "/" + newName ; } return newName ; }
修改路径

@param path
路径
@param newName
新名称
@return 新路径
修改路径