Here you can find the source of normalizeShortUrl(String url)
public static String normalizeShortUrl(String url)
//package com.java2s; //License from project: Apache License public class Main { public static String normalizeShortUrl(String url) { //TODO now only check matching short url, so don't care about RFC standard url = url.toLowerCase();/*from www. j ava 2 s . c o m*/ url = url.replaceAll("^(^(http|https)://)|www.", ""); url = url.replaceAll("//", ""); int endIndex = url.lastIndexOf("/"); if (endIndex == (url.length() - 1)) { url = url.substring(0, endIndex); } return url; } }