Here you can find the source of sanitizeURL(String url)
Parameter | Description |
---|---|
url | a parameter |
public static String sanitizeURL(String url) throws Exception
//package com.java2s; //License from project: Apache License public class Main { /**//from w ww. jav a 2s . c o m * * @param url * @return */ public static String sanitizeURL(String url) throws Exception { try { if (url.substring(0, 7).toLowerCase().equals("http://")) { url = url.substring(7); } else if (url.substring(0, 8).toLowerCase().equals("https://")) { url = url.substring(8); } else if (url.charAt(url.length() - 1) == '/') { url = url.substring(0, url.length() - 1); } } catch (Exception ex) { throw new Exception(ex.getMessage(), ex); } return url; } }