class PathPrefixUtil {

	public static String sanitize(String prefix) {
		if (prefix == null) {
			return "";
		}
		if (prefix.isEmpty()) {
			return prefix;
		}
		prefix = prefix.trim();
		// Ensure that the prefix starts with a slash
		if (!prefix.startsWith("/")) {
			prefix = "/" + prefix;
		}
		// Remove tailing slash
		if (prefix.endsWith("/")) {
			prefix = prefix.substring(0, prefix.length() - 1);
		}
		return prefix;
	}

	private  PathPrefixUtil();

}