public static String getFilename(final String pPath, final char pSeparator) {
        int index = pPath.lastIndexOf(pSeparator);

        if (index < 0) {
            return pPath; // Assume only filename
        }

        return pPath.substring(index + 1);
    }
public static String getFilename ( final String pPath , final char pSeparator ) { int index = pPath . lastIndexOf ( pSeparator ) ; if ( index < 0 ) { return pPath ; } return pPath . substring ( index + 1 ) ; }
Extracts the filename of a complete filename path.

@param pPath      The full filename path.
@param pSeparator The file separator.
@return the extracted filename.
@see File#getName
@see #getDirectoryname