Converts path to Unix convention and adds a terminating slash if it was
omitted

@param path original platform dependent path
@return path in Unix convention
@author Peter Rose
@since 3.2
164827
public static String toUnixPath(String path) {
		String uPath = path;
		if (uPath.contains("\\")) {
			uPath = uPath.replaceAll("\\\\", "/");
		}
		// this should be removed, it's need since "\" is added AtomCache code
		if (uPath.endsWith("//")) {
			uPath = uPath.substring(0, uPath.length() - 1);
		}
		if (!uPath.endsWith("/")) {
			uPath = uPath + "/";
		}
		return uPath;
	}
1088012
public static String normalizePath(String path, String separator) {
    return path.endsWith(separator) ? path : path + separator;
  }
1057364
public static String addTrailingSeparator(String path) {

        int l = path.length();
        if ((l == 0) || (path.charAt(l - 1) != '/')) {
            return path.concat("/");
        } else {
            return path;
        }
    }
276919
private String pathToKey(String path) {
        if (path.startsWith(ValueConsts.DOLLAR_SIGN)) {
            path = path.substring(1);
        }
        if (!path.startsWith(ValueConsts.DOT_SIGN)) {
            path = ValueConsts.DOT_SIGN + path;
        }
        if (!path.endsWith(ValueConsts.DOT_SIGN)) {
            path += ValueConsts.DOT_SIGN;
        }
        return path;
    }
751158
@Nonnull
    public static String normalizeFolder(@Nullable String path) {
        if (path == null) {
            path = "";
        } else {
            path = normalizeFile(path, null);
        }
        if (!path.endsWith("/")) {
            path = path + "/";
        }
        return path;
    }
452302
public static String encodePath(String path) throws NullPointerException {
		return new String(encode(path, UriComponentEncoderBitSets.allowed_abs_path));
	}
568714
public ConfigurationUpdate removePath(String path) {
		if (path == null || !path.startsWith("/")) {
			throw new IllegalArgumentException("Path must start with \"/\".");
		}
		paths.put(path, null);
		return this;
	}
372603
public static final String normalizePath(String path) {
		String normalizedPath = path.replaceAll("//", JawrConstant.URL_SEPARATOR);
		StringTokenizer tk = new StringTokenizer(normalizedPath, JawrConstant.URL_SEPARATOR);
		StringBuilder sb = new StringBuilder();
		while (tk.hasMoreTokens()) {
			sb.append(tk.nextToken());
			if (tk.hasMoreTokens())
				sb.append(JawrConstant.URL_SEPARATOR);
		}
		return sb.toString();

	}
23991
protected String normalizePath(String path) {

        if (path.equals("/")) {
            return path;
        } else {
            return CmsFileUtil.removeTrailingSeparator(path);
        }

    }
1004368
public static String convertToUnixStylePath(String path) {
		String retval = StringSupport.replaceAll(path, "\\", "/");
		retval = StringSupport.replaceAll(retval, new String[]{"///", "//"}, new String[]{"/", "/"});
		return retval;
	}
142470
public Routed<T> route(String path) {
    final String[]            tokens  = Pattern.removeSlashAtBothEnds(path).split("/");
    final Map<String, String> params  = new HashMap<String, String>();
    boolean                   matched = true;

    for (final Pattern<T> pattern : patterns) {
      final String[] currTokens = pattern.tokens();
      final T        target     = pattern.target();

      matched = true;
      params.clear();

      if (tokens.length == currTokens.length) {
        for (int i = 0; i < currTokens.length; i++) {
          final String token     = tokens[i];
          final String currToken = currTokens[i];

          if (currToken.length() > 0 && currToken.charAt(0) == ':') {
            params.put(currToken.substring(1), token);
          } else if (!currToken.equals(token)) {
            matched = false;
            break;
          }
        }
      } else if (currTokens.length > 0 && currTokens[currTokens.length - 1].equals(":*") && tokens.length >= currTokens.length) {
        for (int i = 0; i < currTokens.length - 1; i++) {
          final String token     = tokens[i];
          final String currToken = currTokens[i];

          if (currToken.length() > 0 && currToken.charAt(0) == ':') {
            params.put(currToken.substring(1), token);
          } else if (!token.equals(token)) {
            matched = false;
            break;
          }
        }

        if (matched) {
          final StringBuilder b = new StringBuilder(tokens[currTokens.length - 1]);
          for (int i = currTokens.length; i < tokens.length; i++) {
            b.append('/');
            b.append(tokens[i]);
          }
          params.put("*", b.toString());
        }
      } else {
        matched = false;
      }

      if (matched) return new Routed<T>(target, false, params);
    }

    if (notFound != null) {
      params.clear();
      return new Routed<T>(notFound, true, params);
    }

    return null;
  }
487499
function normalizePath (path) {
		// Remove double slashes
		if (path.indexOf('//') !== -1) {
			path = path.replace(/\/+/g, '/');
		}

		// Shift slash
		if (path[0] === '/') {
			path = path.substr(1);
		}
		
		// Pop slash
		if (path[path.length - 1] === '/') {
			path = path.substr(0, path.length - 1);
		}

		return path;
	}
684801
public static String normalizePath(String path) {
    String normalizedPath = path.replaceAll("//+", "/").replaceFirst("(.+)/$", "$1");
    PathUtils.validatePath(normalizedPath);
    return normalizedPath;
  }
1108190
private static String prependSlash(final String path) {
        if (path.length() == 0 || path.charAt(0) != '/') {
            /* our path doesn't start with a slash, so we prepend it */
            return "/" + path;
        }
        return path;
    }
1218113
public static boolean isAbsolutePath(String path) {
		if (StrUtil.isEmpty(path)) {
			return false;
		}

		if (StrUtil.C_SLASH == path.charAt(0) || path.matches("^[a-zA-Z]:[/\\\\].*")) {
			// 给定的路径已经是绝对路径了
			return true;
		}
		return false;
	}
314454
def path_with_slashes(path)
      path = '/' + path unless path.start_with?('/')
      path << '/' unless path.end_with?('/')
      path
    end
633030
public static String optionallyRemovePrecedingSlash(final String path) {
        // Precondition check
        assertSpecified(path);

        // Is there's a first character of slash
        if (isFirstCharSlash(path)) {
            // Return everything but first char
            return path.substring(1);
        }

        // Return as-is
        return path;
    }