Java Path Concatenate concatPathsStrings(String head, String tail)

Here you can find the source of concatPathsStrings(String head, String tail)

Description

concat Paths Strings

License

Open Source License

Declaration

public static String concatPathsStrings(String head, String tail) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String concatPathsStrings(String head, String tail) {
        String result = null;/*  www  . j a v  a  2s.  co m*/
        if (head.endsWith("/")) {
            if (tail.startsWith("/")) {
                result = head + tail.substring(1, tail.length());
            } else {
                result = head + tail;
            }
        } else {
            if (tail.startsWith("/")) {
                result = head + tail;
            } else {
                result = head + "/" + tail;
            }
        }

        return result;
    }
}

Related

  1. concatPath(String src, String dst)
  2. concatPath(String... path)
  3. concatPaths(String path1, String path2)
  4. concatPaths(String path1, String path2)
  5. concatPaths(String prefix, String postfix)