List of utility methods to do Path Concatenate
String | concatPaths(String path1, String path2) Concatenate two paths together, inserting a '/' if needed, and ensuring that there is no '//' at the join. StringBuilder buffer = new StringBuilder(path1.length() + path2.length() + 1); boolean endsWithSlash = path1.endsWith("/"); boolean beginsWithSlash = path2.startsWith("/"); buffer.append(path1); if (!endsWithSlash) { buffer.append('/'); if (beginsWithSlash) { ... |
String | concatPaths(String prefix, String postfix) Concatenates two paths using forward slashes. String result = prefix; if (!result.endsWith("/")) { result += "/"; result += postfix.startsWith("/") ? postfix.substring(1) : postfix; return result; |
String | concatPathsStrings(String head, String tail) concat Paths Strings String result = null; if (head.endsWith("/")) { if (tail.startsWith("/")) { result = head + tail.substring(1, tail.length()); } else { result = head + tail; } else { ... |