Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.File;
import java.net.URLDecoder;

public class Main {
    public static String getFileNameFromURL(String s) {
        if (s == null) {
            return null;
        }
        String s1 = URLDecoder.decode(s);
        if (s1.indexOf("?") >= 0) {
            s1 = s1.substring(0, s1.indexOf("?"));
        }
        return s1.substring(1 + s1.lastIndexOf(File.separator), s1.length());
    }
}