Here you can find the source of getFileName(final String p)
public static String getFileName(final String p)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static String getFileName(final String p) { return getFileName(new File(p)); }//from w ww . ja va 2 s. c o m public static String getFileName(File p) { String name = p.getName(); int firstIndex = name.indexOf("."); if (firstIndex != -1) { return name.substring(0, firstIndex); } else { return name; } } }