List of utility methods to do Path Normalize
String | normalizePath(String path, String oldFileSeperator, String newFileSeparator) normalize Path boolean containsDrive = path.contains(":"); String newPath = path.replace(oldFileSeperator, newFileSeparator); if (containsDrive) { if (newPath.substring(0, 1).equals(newFileSeparator)) newPath = newPath.substring(1); return newPath; |
String | normalizePath(String path, String separator) Adds a trailing separator if it does not exist in path. return path.endsWith(separator) ? path : path + separator;
|
String | normalizePath(String pathFragment) Normalizes the input path to an absolute path prepending / and ensuring that the path does not end in /. char[] source = pathFragment.toCharArray(); char[] normalized = new char[source.length + 1]; int i = 0; int j = 0; if (source[i] != '/') { normalized[j++] = '/'; boolean slash = false; ... |
String | normalizePath(String pathname) Normalizes a path as per ; StringBuilder ibuf = new StringBuilder(pathname.length() + 1); if (pathname.charAt(0) != '/') { ibuf.append('/'); ibuf.append(pathname); ... |
String | normalizePathElement(String name) normalize Path Element return name.replace("/", "").replace("\\", ""); |
String | normalizePathname(String pathname) Replaces all backslashes with slash char. return pathname.replaceAll("\\\\", "/"); |
String | normalizePathPart(final String path) normalize Path Part String result = path.trim(); while (result.startsWith("/") && result.length() > 1) { result = result.substring(1); return result.replace('\\', '/'); |
String | normalizePaths(String path) Normalizes the input path in the windows and unix world to the Java Representation return path.replaceAll("\\\\", "/"); |
String | normalizePathSeparator(final String path) Makes sure a given path uses the slash character has path separator by replacing all backslashes. return path.replace("\\", STD_SEPARATOR); |
String | normalizeRegex(String path) normalize Regex if (path == null) return null; return path.replaceAll("\\(", "\\\\(").replaceAll("\\)", "\\\\)"); |