Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;

public class Main {

    public static boolean isGif(String url) {
        if (!TextUtils.isEmpty(url)) {
            int index = url.lastIndexOf("suffix=");
            if (index >= 0 && index + 10 <= url.length()) {
                String type = url.substring(index + 7, index + 10);
                if ("gif".equals(type)) {
                    return true;
                }
            }
            if (url.contains(".gif")) {
                return true;
            }
            if (url.contains("format=gif")) {
                return true;
            }
        }
        return false;
    }

    public static boolean isEmpty(String str) {
        if (str == null) {
            return true;
        }
        for (int i = 0, length = str.length(); i < length; i++) {
            if (!Character.isWhitespace(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }
}