Java File Name Create filename(final String path)

Here you can find the source of filename(final String path)

Description

Return the filename part of a path.

License

Open Source License

Parameter

Parameter Description
path a parameter

Declaration

public static String filename(final String path) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w  w  w  .jav a 2  s.  co  m*/
     * Return the filename part of a path.
     *
     * @param path
     * @return
     */
    public static String filename(final String path) {
        int i = path.lastIndexOf('/');
        return (i < 0) ? path : path.substring(i + 1);
    }
}

Related

  1. addTimeStampGetPostFix(Date now, TimeUnit unit)
  2. addTimestampToFilename(Date date, String fileName)
  3. addTimestampToFilename(String fileName)
  4. addTimeStampToFileName(String name)
  5. fileName(Class clazz)
  6. fileName(String contentFile)
  7. fileName(String file)
  8. fileName(String file, String moduleName)
  9. filename(String filename)