Java Folder Read getFileSimpleName(final File f)

Here you can find the source of getFileSimpleName(final File f)

Description

Returns the simple file name (sans extension) for the passed file

License

Apache License

Parameter

Parameter Description
f The file

Return

the simple name

Declaration

public static String getFileSimpleName(final File f) 

Method Source Code

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

import java.io.File;

public class Main {
    /**/* ww w  . j  a va  2  s  . c o  m*/
     * Returns the simple file name (sans extension) for the passed file
     * @param f The file
     * @return the simple name
     */
    public static String getFileSimpleName(final File f) {
        if (f == null)
            throw new RuntimeException("The passed file was null", new Throwable());
        final String name = f.getName();
        final int index = name.indexOf('.');
        if (index == -1)
            return name;
        return name.substring(0, index);
    }
}

Related

  1. getFilesForDirectory(File dir)
  2. getFilesForFolder(File folder)
  3. getFilesForPattern(String pathToScan, String startWith, String endsWith)
  4. getFilesFromClassPath(String classpath)
  5. getFilesFromDiskWorker(File folderToLoad, final String searchPattern, final boolean justFolders)
  6. getFilesInClassPath(String path, String endsWith)
  7. getFilesIncludeSubdirectories(final File directory)
  8. getFilesInFolder(File dir)
  9. getFilesInFolder(final String pathToFolder, final String suffix)