Android String to URL Convert imageUrl_2_ImageName(String imageUrl)

Here you can find the source of imageUrl_2_ImageName(String imageUrl)

Description

image Ur Image Name

Declaration

public static String imageUrl_2_ImageName(String imageUrl) 

Method Source Code

//package com.java2s;

public class Main {
    public static String imageUrl_2_ImageName(String imageUrl) {
        if (imageUrl == null || imageUrl.isEmpty()
                || !imageUrl.contains("http://")) {
            return null;
        }//w  ww . j  a va2s.c om

        int start = imageUrl.lastIndexOf('/');
        if (start == -1) {
            return null;
        }

        int end = imageUrl.lastIndexOf('.');
        if (end == -1) {
            return null;
        }

        if (end <= start + 1) {
            return null;
        }

        return imageUrl.substring(start + 1, end);
    }
}

Related

  1. getBaseUrl(String pageUrl)
  2. getYoutubeId(String url)
  3. preUrl(String url)
  4. TruncateUrlPage(String strURL)
  5. isValidUrl(String url)
  6. extractUrls(String text)
  7. isUrlValid(String str, boolean isCaseSensitve)