Android String to URL Convert getBaseUrl(String pageUrl)

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

Description

get Base Url

Declaration

public static String getBaseUrl(String pageUrl) 

Method Source Code

//package com.java2s;

public class Main {
    public static String getBaseUrl(String pageUrl) {
        try {//from   w  ww .  j  av a2  s  .co  m
            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. isUrlValid(String str)
  2. isHttpUrl(String input)
  3. getDomain(String url)
  4. findUrl(StringBuilder sb)
  5. isImageUrl(String imgUrl)
  6. getYoutubeId(String url)
  7. preUrl(String url)
  8. TruncateUrlPage(String strURL)
  9. isValidUrl(String url)