List of usage examples for java.lang String trim
public String trim()
From source file:Main.java
@SuppressWarnings("unused") private static boolean isNull(String keyString) { if (null == keyString || BLANK_STRING.trim().equals(keyString.trim())) { return true; }/*from w w w . java 2s. c om*/ return false; }
From source file:Main.java
public static String GetFileName(String path) { if (path == null) return ""; if (path.trim().isEmpty()) return ""; File file = new File(path.trim()); String v = file.getName();// w ww. j a v a 2 s. c o m return v == null ? "" : v; }
From source file:ar.com.apachecommonsvalidator.ApacheCommonsValidator.java
private static boolean isValidMail(String email) { if (email == null || "".equals(email)) return false; email = email.trim(); EmailValidator ev = EmailValidator.getInstance(); return ev.isValid(email); }
From source file:Main.java
public static boolean notEmptyOrNull(String string) { if (string != null && !string.equalsIgnoreCase("null") && string.trim().length() > 0) { return true; } else {//from ww w.ja v a2 s .c o m return false; } }
From source file:Main.java
public static boolean isEmpety(String msg) { boolean result = false; if (null == msg || "".equals(msg.trim())) { result = true;/* w w w . j a va2s. co m*/ } return result; }
From source file:Main.java
public static boolean DoesFolderExist(String path) { if (path == null) return false; if (path.trim().isEmpty()) return false; File file = new File(path.trim()); return file.exists() && file.isDirectory(); }
From source file:Main.java
public static boolean DoesFileExist(String path) { if (path == null) return false; if (path.trim().isEmpty()) return false; File file = new File(path.trim()); return file.exists() && file.isFile(); }
From source file:Main.java
public static final boolean isNullOrEmpty(String stg) { return (stg == null || stg.isEmpty() || "".equals(stg.trim().replaceAll("\\s", ""))); }
From source file:Main.java
/** * Given a code and description, join the items together using the join string * @param code//from w ww . j av a 2 s.c om * @param description * @return */ public static String createCombinedKey(String code, String description) { if (code == null || code.trim().equals("")) { return null; } StringBuffer buffy = new StringBuffer(); buffy.append(code); buffy.append(JOIN_STRING); buffy.append(description); return buffy.toString(); }
From source file:Main.java
public static String convertPhoneNumberTo8Format(String text) { try {/*from ww w . j av a2s .com*/ text = text.trim(); if (text.charAt(0) == '+') { text = text.substring(1); } if (text.charAt(0) == '7') { StringBuilder strBuilder = new StringBuilder(text); strBuilder.setCharAt(0, '8'); text = strBuilder.toString(); } BigInteger dummy = new BigInteger(text); if (text.charAt(0) != '8' || text.length() != 11) { throw new Exception(); } } catch (Throwable t) { text = ""; //LOGE("convertPhoneNumberTo8Format: " + t.getMessage()); t.printStackTrace(); } return text; }