Android URL Encode getUrlCode(String pageUrl)

Here you can find the source of getUrlCode(String pageUrl)

Description

get Url Code

Declaration

public static String getUrlCode(String pageUrl) 

Method Source Code

//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;
    }
}

Related

  1. encode(String url)
  2. urlEncode(String url)
  3. encodeURL(String value)
  4. urlEncode(String string)
  5. getURLEncodeStr(String url)
  6. urlEncode(String in)
  7. encode(String s)
  8. encodeParams(ArrayList params)
  9. encodeUrl(Bundle parameters)