Java Path Concatenate concatPaths(String prefix, String postfix)

Here you can find the source of concatPaths(String prefix, String postfix)

Description

Concatenates two paths using forward slashes.

License

Apache License

Parameter

Parameter Description
prefix a parameter
postfix a parameter

Return

the concatenation

Declaration

public static String concatPaths(String prefix, String postfix) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**//from   w  w  w. jav  a  2 s.co m
     * Concatenates two paths using forward slashes.
     * 
     * @param prefix
     * @param postfix
     * @return  the concatenation
     */
    public static String concatPaths(String prefix, String postfix) {
        String result = prefix;
        if (!result.endsWith("/")) {
            result += "/";
        }
        result += postfix.startsWith("/") ? postfix.substring(1) : postfix;
        return result;
    }
}

Related

  1. concatPath(String root, String node)
  2. concatPath(String src, String dst)
  3. concatPath(String... path)
  4. concatPaths(String path1, String path2)
  5. concatPaths(String path1, String path2)
  6. concatPathsStrings(String head, String tail)