List of usage examples for java.lang String trim
public String trim()
From source file:Main.java
public static boolean isNullOrEmpty(String str) { return null == str || str.trim().length() < 1; }
From source file:Main.java
public static Integer getInteger(JTextField txt, Integer defaultVal) { String str = txt.getText(); if (str.trim().length() <= 0) return defaultVal; int val = 0; try {//from w ww. j a v a2 s. c o m val = Integer.parseInt(str); } catch (NumberFormatException ex) { } return new Integer(val); }
From source file:Main.java
private static int getCompressionType(String header) { String s = header.trim(); if (s.equals("") || s.equalsIgnoreCase(C_HEADER_NONE_VAL)) return NONE; else if (s.equalsIgnoreCase(C_HEADER_GZIP_VAL)) return GZIP; else if (s.equalsIgnoreCase(C_HEADER_ZLIB_VAL)) return ZLIB; else// www .java 2s . c o m return -1; }
From source file:Main.java
public static String checkString(String str, String tmp) { if (!(str == null || str.trim().equals("") || str.trim().equals("null"))) return (String) str.trim().toString(); else//from www .j a va 2s . co m return tmp; }
From source file:Main.java
/** * Returns true if the specified string is null or empty. * * @param s//from ww w . j a va 2s . c o m * The string to test. * @return True if the specified string is null or empty. */ private static boolean isEmptyString(String s) { return s == null || s.trim().length() == 0; }
From source file:Main.java
public static boolean isEmpty(String str) { return (str == null || str.trim().equals("")); }
From source file:Main.java
public static boolean isEmpty(String dostr) { if (dostr == null || "".equals(dostr.trim()) || "null".equals(dostr) || dostr == " ") { return true; }/*from w w w .j a v a2 s. co m*/ return false; }
From source file:Main.java
public static String getNonEmptyString(Object obj) { if (!(obj instanceof String)) { return null; }/*www . j a v a 2s .c o m*/ String str = (String) obj; return (str.trim().length() > 0 ? str : null); }
From source file:org.hcmut.emr.SessionBuilder.java
public static String buildValue(String content) { content = content.trim(); String[] str = content.split(" "); if (str.length == 2) { return str[0].substring(0, 3); } else {/*from ww w . java 2s . c om*/ String result = ""; for (int i = 0; i < str.length - 1; i++) { String current = (str[i].length() > 2) ? str[i].trim().substring(0, 2) : str[i].trim().substring(0, 1); result = result + current; } return result; } }
From source file:Main.java
public static boolean stringIsNull(String str) { if (!TextUtils.isEmpty(str) && str.trim().length() != 0) { return false; }//from w w w . j a v a2s . c o m return true; }