Java URL Sanitize sanitizeURL(String url)

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

Description

Attaches the "/" at end of given url.

License

Apache License

Parameter

Parameter Description
url url as a string.

Return

url which ends with "/"

Declaration

public static String sanitizeURL(String url) 

Method Source Code

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

public class Main {
    /**//from   w  w w  .j  a v a2 s .c om
     * Attaches the "/" at end of given url.
     *
     * @param url url as a string.
     * @return url which ends with "/"
     */
    public static String sanitizeURL(String url) {
        if (!url.endsWith("/")) {
            url = url + "/";
        }
        return url;
    }
}

Related

  1. sanitizeDefaultPort(String url)
  2. sanitizeForNextUrl(String url)
  3. sanitizeUri(String uri)
  4. sanitizeUri(String uri)
  5. sanitizeURL(String url)
  6. sanitizeUrl(String url)
  7. sanitizeUrl(String url)
  8. sanitizeUrlWithoutProtocol(String url, String protocol)
  9. sanitizeUrlWithProtocol(String url, String defaultProtocol)