List of usage examples for android.text TextUtils isEmpty
public static boolean isEmpty(@Nullable CharSequence str)
From source file:Main.java
public final static boolean isValidEmail(CharSequence target) { if (TextUtils.isEmpty(target)) { return false; } else {//from w w w . j ava 2 s . c o m return android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches(); } }
From source file:Main.java
public static boolean isEmptyOrWhitespace(String str) { if (TextUtils.isEmpty(str)) { return true; }//from www. j a v a 2s .com for (int i = 0; i < str.length(); i++) { if (!Character.isWhitespace(str.charAt(i))) { return false; } } return true; }
From source file:Main.java
public static String safeText(String prefix, String obj) { if (TextUtils.isEmpty(obj)) return ""; return TextUtils.concat(prefix, obj).toString(); }
From source file:Main.java
public static String getHideMobile(String mobile) { if (TextUtils.isEmpty(mobile)) { return ""; }//from w w w. ja va2 s. c o m if (mobile.length() <= 3) { return mobile; } String str = mobile.substring(0, 3); for (int i = 3; i < mobile.length(); i++) { str += "X"; } return str; }
From source file:Main.java
public static String convertImageURL(String url, int w, int h) { url = TextUtils.isEmpty(url) ? "" : url; String str = new StringBuilder(url).append("?imageView2").append("/1/w/").append(w).append("/h/").append(h) .toString();//w w w . j a v a 2 s . com return str; }
From source file:Main.java
public static String capitalizeFirstLetter(String paramString) { if (TextUtils.isEmpty(paramString)) return paramString; if (paramString.length() == 1) return paramString.toUpperCase(); return Character.toUpperCase(paramString.charAt(0)) + paramString.substring(1); }
From source file:Main.java
public static String getStarMobile(String phoneNumber) { if (TextUtils.isEmpty(phoneNumber) || phoneNumber.length() < 11) { return ""; }/*from w w w. j ava2s . c o m*/ StringBuilder builder = new StringBuilder(); builder.append(phoneNumber.subSequence(0, 3)); builder.append("****"); builder.append(phoneNumber.subSequence(7, 11)); return builder.toString(); }
From source file:Main.java
public static String toLowerCase(String strSrc) { if (TextUtils.isEmpty(strSrc)) { return strSrc; }/*from w w w .j a va2 s. c o m*/ char[] chars = strSrc.toCharArray(); if (chars == null) { return strSrc; } for (int i = 0; i < chars.length; i++) { char c = chars[i]; if ('A' <= c && c <= 'Z') { chars[i] = (char) (c + 'a' - 'A'); } } return String.valueOf(chars); }
From source file:Main.java
public static String mixPhone(String phone) { if (phone == null || TextUtils.isEmpty(phone) || phone.length() != 11) { return ""; }/*w w w . j a v a 2 s . c o m*/ String prefix = phone.substring(0, 3); String suffix = phone.substring(7, 11); return prefix + "****" + suffix; }
From source file:Main.java
public static String convertToQuotedString(String string) { if (TextUtils.isEmpty(string)) return ""; final int lastPos = string.length() - 1; if (lastPos < 0 || (string.charAt(0) == '"' && string.charAt(lastPos) == '"')) { return string; }//from w w w . j av a2 s. c o m return "\"" + string + "\""; }