    public static String mergePaths(String ...items) {
        StringBuilder result = new StringBuilder();
        for (String item: items) {
            boolean trimThisMerge = result.length()>0 && !result.toString().endsWith("://") && !result.toString().endsWith(":///") && !result.toString().endsWith(":");
            if (trimThisMerge) {
                while (result.charAt(result.length()-1)=='/')
                    result.deleteCharAt(result.length()-1);
                result.append('/');
            }
            int i = result.length();
            result.append(item);
            if (trimThisMerge) {
                while (result.charAt(i)=='/')
                    result.deleteCharAt(i);
            }
        }
        return result.toString();
    }

    public static String mergePaths(String ...items) {
        StringBuilder result = new StringBuilder();
        for (String item: items) {
            boolean trimThisMerge = result.length()>0 && !result.toString().endsWith("://") && !result.toString().endsWith(":///") && !result.toString().endsWith(":");
            if (trimThisMerge) {
                while (result.charAt(result.length()-1)=='/')
                    result.deleteCharAt(result.length()-1);
                result.append('/');
            }
            int i = result.length();
            result.append(item);
            if (trimThisMerge) {
                while (result.length()>i && result.charAt(i)=='/')
                    result.deleteCharAt(i);
            }
        }
        return result.toString();
    }
