Here you can find the source of getFilenameOrLastPath(String path)
Parameter | Description |
---|---|
path | The path to be parsed |
public static String getFilenameOrLastPath(String path)
//package com.java2s; //License from project: Open Source License import java.nio.file.Path; import java.nio.file.Paths; public class Main { /**//from w w w . jav a 2s .com * Parses a full path, returning the filename. If full path is a directory, * returns its last part * @param path The path to be parsed * @return The filename of last part of the specified full path */ public static String getFilenameOrLastPath(String path) { Path p = Paths.get(path); return p.getFileName().toString(); } }