Java Path Combine combine(final String path1, final String path2)

Here you can find the source of combine(final String path1, final String path2)

Description

combine

License

Open Source License

Declaration

public static String combine(final String path1, final String path2) 

Method Source Code

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

public class Main {
    public static String combine(final String path1, final String path2) {
        if (path1.endsWith("/") || path1.endsWith(System.getProperty("file.separator"))) {
            return path1 + path2;
        } else {//from   w  ww  . ja  v  a2s .  com
            return path1 + System.getProperty("file.separator") + path2 + System.getProperty("file.separator");
        }
    }

    public static String combine(final String path1, final String path2, final String path3) {
        return combine(combine(path1, path2), path3);
    }

    public static String combine(final String path1, final String path2, final String path3, final String path4) {
        return combine(combine(path1, path2), combine(path3, path4));
    }
}

Related

  1. combine(final String path, final String suffix)
  2. combine(String directory, String filename)
  3. combineDisplayPaths(String parent_display, String display_path)
  4. combinePath(java.io.File parentDir, String... childDirs)
  5. combinePath(String basePath, String withPath)