Java File Name Get getFileName(String path)

Here you can find the source of getFileName(String path)

Description

get File Name

License

Open Source License

Declaration

public static String getFileName(String path) 

Method Source Code


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

import java.io.File;

public class Main {
    public static String getFileName(String path) {
        String filename = path;/*from  www.  j  a  v a  2s. c  o  m*/
        if (filename.contains(File.separator)) {
            filename = filename.substring(filename.lastIndexOf(File.separatorChar) + 1);
        }
        return filename;
    }
}

Related

  1. getFileName(String folder, final String path)
  2. getFilename(String fullFilename)
  3. getFileName(String localRootDirName, String ending)
  4. getFileName(String name)
  5. getFileName(String originPath)
  6. getFilename(String path)
  7. getFileName(String path)
  8. getFilename(String path)
  9. getFileName(String path)