Here you can find the source of extractFileNameFromUrl(String url)
public static String extractFileNameFromUrl(String url)
//package com.java2s; //License from project: Open Source License public class Main { public static String extractFileNameFromUrl(String url) { String newFileName = ""; String tempStr = ""; int counter = url.length() - 1; char ch = url.charAt(counter); while (ch != '/') { tempStr += ch;/*from w w w.j a va 2 s . c om*/ ch = url.charAt(counter); counter--; } for (int i = tempStr.length() - 1; i >= 0; i--) { newFileName += tempStr.charAt(i); } return newFileName; } }