Java tutorial
//package com.java2s; public class Main { public static String getFileName(String url) { int index = url.lastIndexOf("/"); if (index == -1 || index == url.length() - 1) { return url; } else { return url.substring(index + 1); } } }