Java File Name Get getFileNameWithoutExt(File file)

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

Description

get File Name Without Ext

License

Open Source License

Declaration

public static String getFileNameWithoutExt(File file) 

Method Source Code

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

import java.io.File;

public class Main {
    public static String getFileNameWithoutExt(File file) {
        if (file.getName().lastIndexOf(".") == -1)
            return file.getName();
        return file.getName().substring(0, file.getName().lastIndexOf("."));
    }/*from   ww w  .  j  a  va 2  s . com*/
}

Related

  1. getFilenameSuffix(final File file)
  2. getFileNameUtil(String dataPath)
  3. getFileNameWithAddedExtension(File parent, File f, String ext)
  4. getFileNameWithNewExtension(File parent, File file, String ext)
  5. getFilenameWithoutAnyExtension(File file)
  6. getFileNameWithoutExt(File filePath)
  7. getFileNameWithoutExt(String file)
  8. GetFileNameWithoutExt(String file_path)
  9. getFileNameWithoutExt(String fileName)