Java tutorial
//package com.java2s; public class Main { public static String getFileNameFromPath(String filepath) { if ((filepath != null) && (filepath.length() > 0)) { int sep = filepath.lastIndexOf('/'); if ((sep > -1) && (sep < filepath.length() - 1)) { return filepath.substring(sep + 1); } } return filepath; } }