Java File Name Get getFileNameWithoutExtension(String filePath)

Here you can find the source of getFileNameWithoutExtension(String filePath)

Description

get File Name Without Extension

License

BSD License

Declaration

public static String getFileNameWithoutExtension(String filePath) 

Method Source Code


//package com.java2s;
//License from project: BSD License 

import java.io.File;

public class Main {
    public static String getFileNameWithoutExtension(File f) {
        String name = f.getName();
        int i = name.lastIndexOf('.');
        if (i > 0)
            return name.substring(0, i);

        return name;
    }//from w w  w. j  a va2 s. c o m

    public static String getFileNameWithoutExtension(String filePath) {
        return getFileNameWithoutExtension(new File(filePath));
    }
}

Related

  1. getFilenameWithoutExtension(final String fileName)
  2. getFileNameWithoutExtension(final String filePath)
  3. getFileNameWithoutExtension(String fileName)
  4. getFileNameWithoutExtension(String filePath)
  5. getFileNameWithoutExtension(String filePath)
  6. getFileNameWithoutExtension(String fullFilename)
  7. getFileNameWithoutExtensionFromPath(String s)
  8. getFilenameWithoutExtention(File file)
  9. getFileNameWithoutFilePath(File f)