List of utility methods to do String Empty
boolean | isEmpty(String sTest_) Tests, if a given String equals null or "". if (sTest_ == null || sTest_.equals("")) { return true; return false; |
boolean | isEmpty(String str) Beware, the valid word "null" is also rendered as empty. return str == null || "".contentEquals(str) || "null".contentEquals(str); |
boolean | isEmpty(String str) Name: The string is null or empty Description: When the string is null or empty return true,otherwise false String str=null; String str1=""; String str2="abc"; System.out.println(isEmpty(str));//true System.out.println(isEmpty(str1));//true System.out.println(isEmpty(str2));//false return str == null || str.isEmpty();
|
boolean | isEmpty(String str) is Empty if (str != null) { int len = str.length(); for (int x = 0; x < len; ++x) { if (str.charAt(x) > ' ') { return false; return true; |
boolean | isEmpty(String text) Check whether stirng is empty (empty or null). return text == null || text.isEmpty();
|
boolean | isEmptyturnlane(String turns) is Emptyturnlane List<String> turnsList = Arrays.asList("reverse", "sharp_left", "left", "slight_left", "merge_to_right", "through", "reversible", "merge_to_left", "slight_right", "right", "sharp_right"); for (String tl : turnsList) { if (turns.contains(tl)) { return true; return false; ... |
boolean | isNotEmpty(String str) Name: The string is not null and empty Description: When the string is not null and empty return true,otherwise false String str=null; String str1=""; String str2="abc"; System.out.println(isNotEmpty(str));//false System.out.println(isNotEmpty(str1));//false System.out.println(isNotEmpty(str2));//true return !isEmpty(str);
|
void | isNullOrEmpty(String message, String string) is Null Or Empty if ((null == string) || (string.isEmpty())) { throw new IllegalArgumentException(message); |
boolean | isNullOrEmpty(String value) is Null Or Empty return value == null || value.trim().isEmpty();
|
String[] | splitAt(String s, String delimiter, boolean includeEmpty) split At Vector<String> v = new Vector<String>(); int i; while ((i = s.indexOf(delimiter)) >= 0) { if (includeEmpty || i > 0) { v.addElement(s.substring(0, i)); s = s.substring(i + delimiter.length()); if (includeEmpty || s.length() > 0) v.addElement(s); String[] r = new String[v.size()]; v.copyInto(r); return r; |