/** * Gets the path from a full filename, which excludes the prefix. * <p> * This method will handle a file in either Unix or Windows format. * The method is entirely text based, and returns the text before and * including the last forward or backslash. * <pre> * C:\a\b\c.txt --> a\b\ * ~/a/b/c.txt --> a/b/ * a.txt --> "" * a/b/c --> a/b/ * a/b/c/ --> a/b/c/ * </pre> * <p> * The output will be the same irrespective of the machine that the code is running on. * <p> * This method drops the prefix from the result. * See {@link #getDirPath(String)} for the method that retains the prefix. * * @param filepath the path of full filename to query, null returns null * @return the path of the file, an empty string if none exists, null if invalid */ public static String getDirPathWithoutPrefix(String filepath) { return doGetPath(filepath, 1); }