Here you can find the source of cleanPath(String path, boolean trimStartSeparator)
public static String cleanPath(String path, boolean trimStartSeparator)
//package com.java2s; //License from project: LGPL public class Main { public static String cleanPath(String path, boolean trimStartSeparator) { path = path.replaceAll("[/\\\\]+", "/"); if (trimStartSeparator) { path = path.replaceFirst("^/+", ""); }//from ww w . ja va 2 s. co m return path; } }