Here you can find the source of normalize(String path)
Parameter | Description |
---|---|
path | the path to be normalized |
public static String normalize(String path)
//package com.java2s; //License from project: Apache License public class Main { /**/*w w w .ja va 2 s . c o m*/ * The separator between element names. */ public static final String SEPARATOR = "/"; /** * Normalizes the given path (removes superfluous {@link #SEPARATOR separators}). * * @param path the path to be normalized * @return the normalized path */ public static String normalize(String path) { path = path.replace(SEPARATOR + SEPARATOR, SEPARATOR); if (path.startsWith(SEPARATOR)) { path = path.substring(1); } if (path.endsWith(SEPARATOR)) { path = path.substring(0, path.length() - 1); } return path; } }