Java File Name Get getFileNameWithoutExt(String fileName)

Here you can find the source of getFileNameWithoutExt(String fileName)

Description

get File Name Without Ext

License

Open Source License

Declaration

public static String getFileNameWithoutExt(String fileName) 

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  w  w w .  j  a  va 2  s  .co  m*/

    public static String getFileNameWithoutExt(String fileName) {
        if (fileName.lastIndexOf(".") == -1)
            return fileName;
        return fileName.substring(0, fileName.lastIndexOf("."));
    }
}

Related

  1. getFilenameWithoutAnyExtension(File file)
  2. getFileNameWithoutExt(File file)
  3. getFileNameWithoutExt(File filePath)
  4. getFileNameWithoutExt(String file)
  5. GetFileNameWithoutExt(String file_path)
  6. getFileNameWithoutExt(String filePath)
  7. getFileNameWithoutExt(String originPath)
  8. getFilenameWithoutExtension(File f)
  9. getFileNameWithoutExtension(File file)