Example usage for android.text TextUtils isEmpty

List of usage examples for android.text TextUtils isEmpty

Introduction

In this page you can find the example usage for android.text TextUtils isEmpty.

Prototype

public static boolean isEmpty(@Nullable CharSequence str) 

Source Link

Document

Returns true if the string is null or 0-length.

Usage

From source file:Main.java

public static String appCachePath2Root(Context context, String path) {
    if (context == null || TextUtils.isEmpty(path))
        return path;
    String suffix = "/Android/data/" + context.getPackageName() + "/cache";
    return path.replace(suffix, "");
}

From source file:Main.java

public static boolean isPuleNumber(String str) {
    if (TextUtils.isEmpty(str)) {
        return false;
    }// ww  w  .j  a  va 2  s  .  c  o m
    String reg = "^\\d*";
    Pattern pattern = Pattern.compile(reg);
    Matcher matcher = pattern.matcher(str);
    boolean flag = matcher.matches();
    return flag;
}

From source file:Main.java

public static String getServerFileName(String serverPath) {
    String fileName = null;//  w  w w.  ja  va 2s.co  m
    if (serverPath != null && !TextUtils.isEmpty(serverPath)) {
        int index = serverPath.lastIndexOf("/");
        if (index != -1) {
            fileName = serverPath.substring(index + 1);
        }

    }
    return fileName;
}

From source file:Main.java

public static boolean matchMobilNo(String num) {
    if (TextUtils.isEmpty(num)) {
        return false;
    }//from   ww w.ja va2 s.c  o  m
    String reg = "^((13[0-9])|(14[5,7])|(15[^4,\\D])|(17[0,6,7])|(18[0-9]))\\d{8}$";
    Pattern pattern = Pattern.compile(reg);
    Matcher matcher = pattern.matcher(num);
    boolean flag = matcher.matches();
    return flag;
}

From source file:Main.java

public static boolean isMIOSPhone() {
    String model = android.os.Build.MODEL;
    boolean isMi = false;
    if (!TextUtils.isEmpty(model)) {
        isMi = model.startsWith("Mi");
    }/*w  ww.j ava  2s .  c  o  m*/
    if (!isMi) {
        String manu = android.os.Build.MANUFACTURER;
        isMi = (manu != null) ? "Xiaomi".equalsIgnoreCase(manu) : false;
    }
    return isMi;
}

From source file:Main.java

public static boolean isFolderExist(String directoryPath) {
    if (TextUtils.isEmpty(directoryPath)) {
        return false;
    }/*from  ww w  .j av a2 s  . c o m*/

    File dire = new File(directoryPath);
    return (dire.exists() && dire.isDirectory());
}

From source file:Main.java

public static boolean isFiledWithName(Field field, String fieldName) {
    if (field == null || TextUtils.isEmpty(fieldName)) {
        throw new IllegalArgumentException("params is illegal");
    }//  w w  w  .ja v a  2s . c  o m
    if (fieldName.equals(field.getName())) {
        return true;
    }
    return false;
}

From source file:Main.java

public static String base64Decode(String originalString) {
    if (TextUtils.isEmpty(originalString))
        return "";

    return new String(Base64.decode(originalString, 0));
}

From source file:Main.java

public static boolean isEmpty(String s) {
    return TextUtils.isEmpty(s);
}

From source file:Main.java

public static boolean isNumber(String number) {
    if (TextUtils.isEmpty(number))
        return false;
    else {//from  w  w  w.j  a va 2s . com
        Pattern p = Pattern.compile("[0-9]*");
        Matcher m = p.matcher(number);
        if (m.matches())
            return true;
        else
            return false;
    }
}