Here you can find the source of getFilenameOnly(File file)
Parameter | Description |
---|---|
file | The input file to get the name of. |
public static String getFilenameOnly(File file)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { /**/* w w w. jav a 2s . c om*/ * Get the file name with the dot and extension stripped off. * @param file The input file to get the name of. * @return The file name. */ public static String getFilenameOnly(File file) { String filename = file.getName(); if (filename.contains(".")) { return filename.substring(0, filename.lastIndexOf(".")); } return null; } }