List of usage examples for android.text TextUtils isEmpty
public static boolean isEmpty(@Nullable CharSequence str)
From source file:Main.java
public static String firstUrl(String text) { if (!TextUtils.isEmpty(text)) for (String s : text.split("\\s+")) if (Patterns.WEB_URL.matcher(s).matches()) return s; return null;//from w w w . ja va 2 s . co m }
From source file:Main.java
public static boolean isPhoneNumberAvailable(String phoneNumber) { if (TextUtils.isEmpty(phoneNumber)) { return false; }// ww w .j a va 2 s . c om if (phoneNumber.length() != 11 || !phoneNumber.substring(0, 1).equals("1") || phoneNumber.contains("*") || phoneNumber.contains("#")) { return false; } else { return true; } }
From source file:Main.java
public static String root2AppCachePath(Context context, String root) { if (context == null || TextUtils.isEmpty(root)) return null; return root + "/Android/data/" + context.getPackageName() + "/cache"; }
From source file:Main.java
public static String root2AppFilesPath(Context context, String root) { if (context == null || TextUtils.isEmpty(root)) return null; return root + "/Android/data/" + context.getPackageName() + "/files"; }
From source file:Main.java
public static boolean isValidMobilePhone(String s) { if (TextUtils.isEmpty(s)) { return false; }/*from w w w . j av a2 s. c om*/ Pattern pattern = Pattern.compile("1[0-9]{10}"); Matcher matcher = pattern.matcher(s); return matcher.matches(); }
From source file:Main.java
public static String getPhoneNum(String formatedPhoneNum) { if (TextUtils.isEmpty(formatedPhoneNum)) { return ""; } else {//from w w w. j av a 2 s. c o m if (formatedPhoneNum.startsWith("+86")) { formatedPhoneNum = formatedPhoneNum.substring(3, formatedPhoneNum.length()); } else if (formatedPhoneNum.startsWith("0086")) { formatedPhoneNum = formatedPhoneNum.substring(4, formatedPhoneNum.length()); } else if (formatedPhoneNum.startsWith("+0086")) { formatedPhoneNum = formatedPhoneNum.substring(5, formatedPhoneNum.length()); } return formatedPhoneNum.replaceAll(" ", "").replaceAll(" \t", ""); } }
From source file:Main.java
public static boolean isNumeric(String str) { if (TextUtils.isEmpty(str)) { return false; }/*from w w w . ja va 2s . co m*/ Pattern pattern = Pattern.compile("[0-9]*"); Matcher isNum = pattern.matcher(str); if (!isNum.matches()) { return false; } return true; }
From source file:Main.java
public static boolean isQQNumber(String qqNumber) { if (!TextUtils.isEmpty(qqNumber)) { Pattern pattern = Pattern.compile("\\d{4,12}$"); Matcher matcher = pattern.matcher(qqNumber); return matcher.find(); }//from w w w . j av a2 s .co m return false; }
From source file:Main.java
public static Pattern getPostalCodeRegexpPatternForAdminArea(String zipStartsWithRegEx) { if (TextUtils.isEmpty(zipStartsWithRegEx)) { return null; }//from w w w. ja v a2 s. c o m return Pattern.compile("(" + zipStartsWithRegEx + ").*", 2); }
From source file:Main.java
public static String appFilesPath2Root(Context context, String path) { if (context == null || TextUtils.isEmpty(path)) return path; String suffix = "/Android/data/" + context.getPackageName() + "/files"; return path.replace(suffix, ""); }