Here you can find the source of getFileName(String path)
public static String getFileName(String path)
//package com.java2s; //License from project: Open Source License import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static String getFileName(String path) { Path p = Paths.get(path); String fname = p.getFileName().toString(); int lio = fname.lastIndexOf("."); return fname.substring(0, lio); }/*from w ww . j a v a2 s.c o m*/ }