Android String to URL Convert isImageUrl(String imgUrl)

Here you can find the source of isImageUrl(String imgUrl)

Description

is Image Url

License

Open Source License

Declaration

public static boolean isImageUrl(String imgUrl) 

Method Source Code

//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static boolean isImageUrl(String imgUrl) {
        if (isEmptyOrNull(imgUrl)) {
            return false;
        }/*from w ww  .  ja va 2s. c  om*/
        String regEx = "([^\\s]+(\\.(?i)(jpg|png|gif))$)";
        Pattern pattern = Pattern.compile(regEx);
        Matcher matcher = pattern.matcher(imgUrl);
        return matcher.matches();
    }

    public static boolean isEmptyOrNull(String str) {
        return str == null || str.length() == 0
                || str.contentEquals("null") || str.trim().equals("");
    }
}

Related

  1. isUrl(String s)
  2. isUrlValid(String str)
  3. isHttpUrl(String input)
  4. getDomain(String url)
  5. findUrl(StringBuilder sb)
  6. getBaseUrl(String pageUrl)
  7. getYoutubeId(String url)
  8. preUrl(String url)
  9. TruncateUrlPage(String strURL)