Here you can find the source of getFileNameWithoutExtension(String filePath)
public static String getFileNameWithoutExtension(String filePath)
//package com.java2s; //License from project: BSD License import java.io.File; public class Main { public static String getFileNameWithoutExtension(File f) { String name = f.getName(); int i = name.lastIndexOf('.'); if (i > 0) return name.substring(0, i); return name; }//from w w w. j a va2 s. c o m public static String getFileNameWithoutExtension(String filePath) { return getFileNameWithoutExtension(new File(filePath)); } }