List of usage examples for java.lang String trim
public String trim()
From source file:Main.java
public static boolean isNullOrEmpty(String s) { return s == null || s.trim().isEmpty(); }
From source file:Main.java
public static boolean isNumeric(String str) { if (str == null || (str.trim().equals(""))) { return false; }// ww w .j a v a 2 s. c o m Pattern pattern = Pattern.compile("[0-9]*"); return pattern.matcher(str).matches(); }
From source file:Main.java
public static boolean checkStringNotNull(String text) { if (text != null && !(text.trim().equals(""))) { return true; } else {// w w w . j a va2s .c o m return false; } }
From source file:Main.java
public static boolean isTextXML(String text) { text = text.trim(); if (!(text.startsWith("<") && text.endsWith(">"))) return false; //If text doesn't begin with "<" it's not XML int firstClose = text.indexOf(">"); int lastOpen = text.lastIndexOf("<"); if (lastOpen == 0 && text.lastIndexOf("/") == firstClose - 1) return true; //Example "<DIMES /> if (text.substring(1, firstClose + 1).equals(text.substring(lastOpen + 2))) return true; //<XML> blah </XML> return false; }
From source file:Main.java
public static boolean isEmpty(String str) { return str == null || str.trim().length() == 0 || str.trim().equalsIgnoreCase("null"); }
From source file:Main.java
public static String checkString(String text) { if (text != null && !(text.trim().equals(""))) { return text.trim(); } else {/* w ww . ja v a 2s .c o m*/ return ""; } }
From source file:Main.java
public static boolean isEmail(String email) { if (email == null || email.trim().length() == 0) return false; return EMAILER.matcher(email).matches(); }
From source file:Main.java
public static boolean isEmail(String email) { if (email == null || email.trim().length() == 0) return false; return emailPat.matcher(email).matches(); }
From source file:Main.java
public static boolean isEmpty(String str) { return str == null || "".equals(str.trim()); }
From source file:Main.java
/** * A method to check whether a string is null or empty. * * @param String ./*from www .j a v a2 s .c om*/ * @return boolean true or false. */ public static boolean isNullOrEmpty(String s) { return s == null ? true : (s.trim().length() <= 0); }