Here you can find the source of getUrlCode(String pageUrl)
public static String getUrlCode(String pageUrl)
//package com.java2s; public class Main { public static String getUrlCode(String pageUrl) { try {/* w w w. j a v a 2 s . c o m*/ String temp = getBaseUrl(pageUrl); temp = temp.substring(temp.indexOf("://") + 3).replace(".", "") .replace("/", ""); return temp; } catch (Exception e) { } return null; } public static String getBaseUrl(String pageUrl) { try { if (!pageUrl.contains("://")) { pageUrl = "http://" + pageUrl; } int end = pageUrl.indexOf("/", pageUrl.indexOf("://") + 4); return pageUrl.substring(0, end); } catch (Exception e) { } return null; } }