Java URL Clear cleanUrl(String url)

Here you can find the source of cleanUrl(String url)

Description

clean Url

License

Apache License

Declaration

public static String cleanUrl(String url) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String cleanUrl(String url) {
        String cleanUrl = url.trim();
        if (cleanUrl.length() >= 8) {
            if (cleanUrl.substring(0, 7).equalsIgnoreCase("http://")) {
                cleanUrl = "http://" + cleanUrl.substring(7);
            } else if (cleanUrl.substring(0, 8).equalsIgnoreCase("https://")) {
                cleanUrl = "https://" + cleanUrl.substring(8);
            }//from   ww  w.  ja v a 2 s  .co  m
        }
        return cleanUrl;
    }
}

Related

  1. cleanURL(final String input)
  2. cleanUrl(String encodedUrl)
  3. cleanUrl(String uriStr)
  4. cleanUrl(String url)
  5. cleanUrlTitle(String programTitle)