Here you can find the source of getFileNameWithoutExt(String fileName)
public static String getFileNameWithoutExt(String fileName)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String getFileNameWithoutExt(File file) { if (file.getName().lastIndexOf(".") == -1) return file.getName(); return file.getName().substring(0, file.getName().lastIndexOf(".")); }/*from w w w . j a va 2 s .co m*/ public static String getFileNameWithoutExt(String fileName) { if (fileName.lastIndexOf(".") == -1) return fileName; return fileName.substring(0, fileName.lastIndexOf(".")); } }