package com.baidu.rtc.sample.util;

import android.text.TextUtils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class StringUtils {

    public static String encodeUrl(String str) {
        if (TextUtils.isEmpty(str)) {
            return "";
        } else {
            String tstr = "";

            try {
                tstr = URLEncoder.encode(str, "utf-8");
            } catch (UnsupportedEncodingException var3) {
                tstr = str;
            }

            return tstr;
        }
    }

    /**
     * 是否是空
     *
     * @param string 字符串
     * @return true : 空字符串
     */
    public static boolean isEmpty(String string) {
        return string == null || "null".equals(string) || string.trim().length() == 0 || string.length() == 0;
    }

    public static boolean isNull(String str) {
        boolean b = false;
        if (str == null || str.trim().length() == 0) {
            b = true;
        }

        return b;
    }
}
