List of usage examples for android.text TextUtils isEmpty
public static boolean isEmpty(@Nullable CharSequence str)
From source file:Main.java
public static Thread newThread(Runnable r, String name) { if (TextUtils.isEmpty(name)) { throw new RuntimeException("thread name should not be empty"); }//from ww w .j av a 2s.c om return new Thread(r, getStandardThreadName(name)); }
From source file:Main.java
public static String concatenateWhereOR(String a, String b) { if (TextUtils.isEmpty(a)) { return b; }/*from ww w . j a va 2 s .c o m*/ if (TextUtils.isEmpty(b)) { return a; } return "(" + a + ") OR (" + b + ")"; }
From source file:Main.java
public static boolean isFileExist(String path) { if (TextUtils.isEmpty(path)) return false; File file = new File(path); return file.exists() && file.isFile(); }
From source file:Main.java
public static String concatenateWhereAND(String a, String b) { if (TextUtils.isEmpty(a)) { return b; }//w ww .j a va2 s. c om if (TextUtils.isEmpty(b)) { return a; } return "(" + a + ") AND (" + b + ")"; }
From source file:Main.java
public static boolean isNullOrBlank(String content) { if (content == null || TextUtils.isEmpty(content.trim())) { return true; }//from w ww.java 2 s . c o m return false; }
From source file:Main.java
public static void delFile(String path) { if (!TextUtils.isEmpty(path)) { File file = new File(path); if (file.exists()) { file.delete();//from w w w . j a v a2 s. c om } } }
From source file:Main.java
public static boolean hasMytext(String string, String mytext) { if (TextUtils.isEmpty(string) && TextUtils.isEmpty(mytext)) return false; else {//from www . j ava2s .co m if (string.contains(mytext)) return true; else return false; } }
From source file:Main.java
public static boolean isFileExists(String path) { if (TextUtils.isEmpty(path)) { return false; }/*from w w w. j a v a 2 s . co m*/ return new File(path).exists(); }
From source file:Main.java
public static String getStarMobile(String mobile) { if (TextUtils.isEmpty(mobile)) return ""; int length = mobile.length(); if (length == 11) { StringBuilder builder = new StringBuilder(); builder.append(mobile.substring(0, 3)).append("****").append(mobile.substring(7)); return builder.toString(); } else if (length > 7 && length < 11) { StringBuilder builder = new StringBuilder(); builder.append(mobile.substring(0, 2)).append("****").append(mobile.substring(6)); return builder.toString(); } else {/*from w w w.j a v a 2 s. c o m*/ return mobile; } }
From source file:Main.java
public static String escapeExprSpecialWord(String keyword) { if (!TextUtils.isEmpty(keyword)) { String[] fbsArr = { "\\", "$", "(", ")", "*", "+", ".", "[", "]", "?", "^", "{", "}", "|" }; for (String key : fbsArr) { if (keyword.contains(key)) { keyword = keyword.replace(key, "\\" + key); }/*from w w w .j a va 2s . c om*/ } } return keyword; }