Java File Name Extract extractFileName(String fileName)

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

Description

extract File Name

License

Open Source License

Declaration

public static String extractFileName(String fileName) 

Method Source Code

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

public class Main {
    public static String extractFileName(String fileName) {
        if (null == fileName || "".equals(fileName.trim())) {
            throw new IllegalArgumentException("File Name cannot be Null/Empty");
        }/*from  w w w . java  2s .  c  o  m*/
        int extensionStartPt = fileName.lastIndexOf(".");
        return fileName.substring(0, extensionStartPt);
    }
}

Related

  1. extractFileName(final String filePath)
  2. extractFileName(StackTraceElement aFrame)
  3. extractFileName(String file)
  4. extractFileName(String filePathName)
  5. extractFileName(String filePathName)
  6. extractFileName(String fn)
  7. extractFileName(String fullPath)