Java File Name Get getFilenameWithoutExtention(File file)

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

Description

get Filename Without Extention

License

Open Source License

Declaration

public static String getFilenameWithoutExtention(File file) 

Method Source Code

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

import java.io.File;

public class Main {
    public static String getFilenameWithoutExtention(File file) {
        return stripExtension(file.getName());
    }/* w  w  w.j  ava  2s  . co  m*/

    public static String stripExtension(String str) {
        if (str == null)
            return null;
        int pos = str.lastIndexOf(".");
        if (pos == -1)
            return str;
        return str.substring(0, pos);
    }
}

Related

  1. getFileNameWithoutExtension(String filePath)
  2. getFileNameWithoutExtension(String filePath)
  3. getFileNameWithoutExtension(String filePath)
  4. getFileNameWithoutExtension(String fullFilename)
  5. getFileNameWithoutExtensionFromPath(String s)
  6. getFileNameWithoutFilePath(File f)
  7. getFilenameWithoutPath(String path)
  8. getFileNameWithPath(String path, String fileNameWithoutFullPath)