Java File Name Get getFileName(File file)

Here you can find the source of getFileName(File file)

Description

get File Name

License

Open Source License

Declaration

public static String getFileName(File file) 

Method Source Code

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

import java.io.File;

public class Main {

    public static String getFileName(File file) {
        if (file.isDirectory()) {
            return file.getName();
        }/*from  w w  w . ja  va  2 s .  c om*/
        String name = file.getName();
        return name.substring(0, name.indexOf("."));
    }
}

Related

  1. getFileName(File file)
  2. getFileName(File file)
  3. getFilename(File file)
  4. getFilename(File file)
  5. getFilename(File file)
  6. getFileName(File file)
  7. getFileName(File file)
  8. getFilename(File file, boolean withExtension)
  9. getFileName(File path)