Here you can find the source of getFileName(String s)
public static String getFileName(String s)
//package com.java2s; import java.io.File; public class Main { public static String getFileName(String s) { int index = s.lastIndexOf("/"); String name = null;// ww w .j a v a 2s .co m if (index > -1) { name = s.substring(index + 1); } else { index = s.lastIndexOf(File.separator); if (index > 0) { name = s.substring(index + 1); } } return name; } }