Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static String getFileName(String pathAndName) { int start = pathAndName.lastIndexOf("/"); int end = pathAndName.lastIndexOf("."); if (start != -1 && end != -1) { return pathAndName.substring(start + 1, end); } else { return null; } } }