@Test public void testIsBlank() { String[] blanks = {null , "", " ", "null", "Null", "NULL", "undefined", "UNDEFINED", "Undefined"}; String[] notBlanks = {"a", "1", " a", " a ", " 1 ", "a13 ", " a13 "}; for (String str : blanks) { assertTrue(StringUtils.isBlank(str)); } for (String str : notBlanks) { assertFalse(StringUtils.isBlank(str)); } }
public static boolean isBlank(String str) { if (str == null) { return true; } else { str = str.trim(); if (str.length() <= 0) { return true; } else if ("null".equalsIgnoreCase(str) || "undefined".equalsIgnoreCase(str)) { return true; } else { return false; } } }
StringUtils { public static boolean isBlank(String str) { if (str == null) { return true; } else { str = str.trim(); if (str.length() <= 0) { return true; } else if ("null".equalsIgnoreCase(str) || "undefined".equalsIgnoreCase(str)) { return true; } else { return false; } } } }
StringUtils { public static boolean isBlank(String str) { if (str == null) { return true; } else { str = str.trim(); if (str.length() <= 0) { return true; } else if ("null".equalsIgnoreCase(str) || "undefined".equalsIgnoreCase(str)) { return true; } else { return false; } } } private  StringUtils(); }
StringUtils { public static boolean isBlank(String str) { if (str == null) { return true; } else { str = str.trim(); if (str.length() <= 0) { return true; } else if ("null".equalsIgnoreCase(str) || "undefined".equalsIgnoreCase(str)) { return true; } else { return false; } } } private  StringUtils(); static String byte2Base64String(byte[] value); static byte[] Base64String2Byte(String base64Str); static String byte2HexString(byte b); static byte[] hexString2Byte(String input); static String byte2HexString(byte[] bs); static boolean isBlank(String str); static boolean isChinese(String str); static boolean isChinese(char c); static String merge(Collection<?> coll); static String merge(Collection<?> coll, char separate); static String merge(Collection<?> coll, String separate); static String merge(String[] str); static String merge(String[] str, char separate); static String merge(String[] str, String separate); static String merge(String str, int length); static String merge(String str, int length, String separate); static String merge(String str, int length, char separate); static String repeat(int length, String str); static String[] split(String s); static String[] split(String s, boolean trimTokens, boolean ignoreEmptyTokens); static String[] split(String s, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens); static boolean string2Boolean(String str, boolean defaultValue); static int string2Int(String str, TypeUtils.Radix radix, int defaultValue); static long string2Long(String str, TypeUtils.Radix radix, long defaultValue); static float string2Float(String str, float defaultValue); static double string2Double(String str, double defaultValue); static long string2Size(String size, long defaultValue); static long stirng2TimePeriod(String timePeriod, long defaultValue); static String truncate(String src, int length); static String xmlEscape(String str); static String xmlUnescape(String str); }
StringUtils { public static boolean isBlank(String str) { if (str == null) { return true; } else { str = str.trim(); if (str.length() <= 0) { return true; } else if ("null".equalsIgnoreCase(str) || "undefined".equalsIgnoreCase(str)) { return true; } else { return false; } } } private  StringUtils(); static String byte2Base64String(byte[] value); static byte[] Base64String2Byte(String base64Str); static String byte2HexString(byte b); static byte[] hexString2Byte(String input); static String byte2HexString(byte[] bs); static boolean isBlank(String str); static boolean isChinese(String str); static boolean isChinese(char c); static String merge(Collection<?> coll); static String merge(Collection<?> coll, char separate); static String merge(Collection<?> coll, String separate); static String merge(String[] str); static String merge(String[] str, char separate); static String merge(String[] str, String separate); static String merge(String str, int length); static String merge(String str, int length, String separate); static String merge(String str, int length, char separate); static String repeat(int length, String str); static String[] split(String s); static String[] split(String s, boolean trimTokens, boolean ignoreEmptyTokens); static String[] split(String s, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens); static boolean string2Boolean(String str, boolean defaultValue); static int string2Int(String str, TypeUtils.Radix radix, int defaultValue); static long string2Long(String str, TypeUtils.Radix radix, long defaultValue); static float string2Float(String str, float defaultValue); static double string2Double(String str, double defaultValue); static long string2Size(String size, long defaultValue); static long stirng2TimePeriod(String timePeriod, long defaultValue); static String truncate(String src, int length); static String xmlEscape(String str); static String xmlUnescape(String str); static final char DEFAULT_SEPARATOR; static final String DELIMITERS; }