Java File Name Get getFilename(final File file)

Here you can find the source of getFilename(final File file)

Description

get Filename

License

Open Source License

Parameter

Parameter Description
file a parameter

Return

String

Declaration

public static String getFilename(final File file) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Manchester Centre for Integrative Systems Biology
 * University of Manchester//ww w. ja  v  a 2  s . c o  m
 * Manchester M1 7ND
 * United Kingdom
 * 
 * Copyright (C) 2007 University of Manchester
 * 
 * This program is released under the Academic Free License ("AFL") v3.0.
 * (http://www.opensource.org/licenses/academic.php)
 *******************************************************************************/

import java.io.*;

public class Main {
    /**
     * 
     */
    public final static String EXTENSION_SEPARATOR = ".";

    /**
     * 
     * @param file
     * @return String
     */
    public static String getFilename(final File file) {
        return file.getName().substring(0, file.getName().lastIndexOf(EXTENSION_SEPARATOR));
    }
}

Related

  1. getFileName(File file)
  2. getFilename(File file)
  3. getFilename(File file, boolean withExtension)
  4. getFileName(File path)
  5. getFileName(final File file)
  6. getFileName(final File file)
  7. getFilename(final String filenamePath)
  8. getFileName(final String p)
  9. getFilename(final String pPath)