Java File Naked Name Get getFileNameNoExt(File file)

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

Description

Removes extension from file name

License

Open Source License

Parameter

Parameter Description
file File to remove extension from.

Declaration

public static String getFileNameNoExt(File file) 

Method Source Code

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

import java.io.File;

public class Main {
    /** Removes extension from file name
     * @param file  {@code File} to remove extension from.
     * @returns  Literal file name without the extension.
     *//* w  ww .j  a v  a 2 s  .c om*/
    public static String getFileNameNoExt(File file) {
        String filename = file.getName();
        return filename.substring(0, filename.lastIndexOf("."));
    }
}

Related

  1. extractFileWithoutExtension(String filename)
  2. extractFileWithoutPath(String input)
  3. fileNameWithoutExtension(String filename)
  4. filenameWithoutExtension(String filename)
  5. getFilenameNoExt(File f)
  6. getFileNameNoExt(String path)
  7. getFileNameNoExtension(File file)
  8. getFileWithoutEnding(String absolutePath)
  9. getFileWithoutExtension(File f)