List of usage examples for android.text TextUtils isEmpty
public static boolean isEmpty(@Nullable CharSequence str)
From source file:Main.java
public static int getTextToInteger(String text) { if (TextUtils.isEmpty(text)) { return 0; } else if (TextUtils.isDigitsOnly(text)) { return Integer.valueOf(text); }// w w w. j a va2 s . co m return 0; }
From source file:Main.java
public static String pathToName(String path) { if (TextUtils.isEmpty(path)) return path; int lastSlash = path.lastIndexOf('/'); if (lastSlash != -1 && lastSlash + 1 < path.length()) return path.substring(lastSlash + 1); else/*from w ww . java 2s . c o m*/ return path; }
From source file:Main.java
public static String remove86(String phone) { if (TextUtils.isEmpty(phone)) { return phone; }//from w w w .j av a 2 s .co m String str = phone; if (phone.startsWith("86")) str = phone.substring(2); else if (phone.startsWith("+86")) str = phone.substring(3); return str; }
From source file:Main.java
public static String filterCharacter(String text) { if (TextUtils.isEmpty(text)) return ""; return text.replaceAll("[^0-9a-zA-Z\u4e00-\u9fa5]", ""); }
From source file:Main.java
public static boolean isNotEmpty(String text) { if (!TextUtils.isEmpty(text)) { return true; }//www. ja v a 2 s . c o m return false; }
From source file:Main.java
public static int[] strToArray(String str) { if (!TextUtils.isEmpty(str)) { String[] strArray = str.split("\\."); int[] result = new int[strArray.length]; for (int i = 0; i < strArray.length; i++) { result[i] = Integer.valueOf(strArray[i]); }/*from w w w .j ava2s. c om*/ return result; } return null; }
From source file:Main.java
public static boolean isNotNullOrZero(String money) { return !TextUtils.isEmpty(money) && !"0".equalsIgnoreCase(money) && !"0.0".equalsIgnoreCase(money) && !"0.00".equalsIgnoreCase(money); }
From source file:Main.java
public static boolean isPhoneNumberValid(String mobile) { return !(TextUtils.isEmpty(mobile) || !TextUtils.isDigitsOnly(mobile) || mobile.length() != 11); }
From source file:Main.java
public static boolean isImage(String type) { if (TextUtils.isEmpty(type)) { return false; }//from w w w . j a va2 s.c o m type = type.toLowerCase(); if ((type.equals("jpg") || type.equals("gif") || type.equals("png") || type.equals("jpeg") || type.equals("bmp") || type.equals("wbmp") || type.equals("ico") || type.equals("jpe"))) { return true; } return false; }
From source file:Main.java
public static boolean isBlueToothName(String name) { if (!TextUtils.isEmpty(name) && name.startsWith("JY")) { return true; }//from www .j a v a 2 s .co m return false; }