uri的深度计算

来源:互联网 发布:php后端开发需要学什么 编辑:程序博客网 时间:2024/05/17 22:39
    public int depth(URI uri) {        String path = uri.getPath();        int depth = 0;        int slash = path.length() == 1 && path.charAt(0) == '/' ? -1 : 0;        while (slash != -1) {            depth++;            slash = path.indexOf("/", slash + 1);        }        return depth;    }

0 0
原创粉丝点击