Here you can find the source of getFileNameWithoutExtension(File file)
public static String getFileNameWithoutExtension(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String getFileNameWithoutExtension(File file) { String fileName = null;/*from ww w . j a v a2s. c om*/ if (file == null) { throw new IllegalArgumentException("file cannot be null"); } int fileExtensionIndex = file.getName().lastIndexOf("."); if (fileExtensionIndex <= 0) { return file.getName(); } fileName = file.getName().substring(0, fileExtensionIndex); return fileName; } }