Java URL Normalize normalizeUrlStr(String urlStr)

Here you can find the source of normalizeUrlStr(String urlStr)

Description

normalize Url Str

License

Open Source License

Declaration

public static String normalizeUrlStr(String urlStr) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String normalizeUrlStr(String urlStr) {
        if (urlStr == null)
            return (null);

        if (!urlStr.startsWith("http://"))
            urlStr = "http://" + urlStr;

        // TODO: handle lack of "www."?
        //if (urlStr.startsWith("http://")) {
        //   if (urlStr.substring())
        //}//from w  ww .j av  a2 s  .c  om
        if (urlStr.endsWith("/"))
            return (urlStr.substring(0, urlStr.length() - 1));

        return (urlStr);
    }
}

Related

  1. normalizeUrl(URL url)
  2. normalizeURL(URL url)
  3. normalizeUrl(URL url)
  4. normalizeUrl(URL url)
  5. normalizeURL(URL url)