List of usage examples for android.text TextUtils isEmpty
public static boolean isEmpty(@Nullable CharSequence str)
From source file:Main.java
public static String preparePathForPicasso(String path) { if (TextUtils.isEmpty(path) || path.contains("https://") || path.contains("http://")) { return path; }//from ww w. ja va2 s . co m return "file:" + path; }
From source file:Main.java
public static boolean isCorrectIDCardNumber(String idCardNumber) { return !TextUtils.isEmpty(idCardNumber) && Pattern.matches("(\\d{14}[0-9a-zA-Z])|(\\d{17}[0-9a-zA-Z])", idCardNumber); }
From source file:Main.java
public static String formatMobileStar(String mobile) { if (TextUtils.isEmpty(mobile)) return ""; if (mobile.length() < 11) return mobile; return mobile.substring(0, 3) + "****" + mobile.substring(7, 11); }
From source file:Main.java
public static boolean isUser(SharedPreferences user_sp) { if (TextUtils.isEmpty(user_sp.getString("userid", ""))) { return false; }//from w w w. j ava 2 s .com return true; }
From source file:Main.java
public static String getFilenameWithoutExt(String path) { String filename = ""; if (!TextUtils.isEmpty(path)) { int indexOfSlash = path.lastIndexOf('/'); int indexOfDot = path.lastIndexOf('.'); if (indexOfDot <= indexOfSlash) { indexOfDot = path.length();//from ww w.j av a 2s . c o m } filename = path.substring(indexOfSlash + 1, indexOfDot); } return filename; }
From source file:Main.java
public static boolean isValidEmailAddress(String emailAddress) { if (!TextUtils.isEmpty(emailAddress)) { String regex = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"; return Pattern.matches(regex, emailAddress); }/* w w w . j a v a2s.c om*/ return false; }
From source file:Main.java
public static String getMucNumId(String mucId) { if (!TextUtils.isEmpty(mucId)) { if (mucId.endsWith(MUC_TAIL)) { return mucId.substring(0, mucId.lastIndexOf(MUC_TAIL)); }/* w w w . java2 s .co m*/ } return mucId; }
From source file:Main.java
public static boolean isLawyer(SharedPreferences user_sp) { if (TextUtils.isEmpty(user_sp.getString("lawyerid", ""))) { return false; }// w w w. j a va 2s. c o m return true; }
From source file:Main.java
public static boolean isPasswordValid(String password) { Boolean isPasswordValid = true; if (!TextUtils.isEmpty(password)) { if (TextUtils.getTrimmedLength(password) <= 7) { isPasswordValid = false;// w w w . j ava 2s. co m } } else { isPasswordValid = false; } return isPasswordValid; }
From source file:Main.java
public static boolean fileExists(String path) { boolean exists = false; if (!TextUtils.isEmpty(path)) { File file = new File(path); exists = file.exists() && file.isFile(); }/* www . ja v a2 s.c o m*/ return exists; }