Android URL to String Convert getNoQueryUrl(String source)

Here you can find the source of getNoQueryUrl(String source)

Description

get No Query Url

Declaration

public static String getNoQueryUrl(String source) 

Method Source Code

//package com.java2s;

import java.net.MalformedURLException;
import java.net.URL;

public class Main {
    public static String getNoQueryUrl(String source) {
        String dest = null;/*w ww.  ja  v  a  2s. c o m*/
        try {
            URL sUrl = new URL(source);
            URL dUrl = new URL(sUrl.getProtocol(), sUrl.getHost(),
                    sUrl.getPort(), sUrl.getPath());
            dest = dUrl.toString();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        return dest;
    }
}