List of utility methods to do Boolean From
boolean | toBool(Boolean obj) to Bool if (obj == null) { return false; } else { return obj; |
boolean | toBool(int[] data, int index) Extract a boolean value from an array of int data int length = data.length; if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index: " + index + ", Length: " + length); return data[index] == 0 ? false : true; |
boolean | toBool(long l) Returns the boolean for the given long. If long is 1L this will return TRUE, else FALSE. if (l == 1L) { return true; return false; |
boolean | toBool(String bStr) to Bool if (bStr != null) { return Boolean.parseBoolean(bStr); return false; |
String | toBool(String bv) to Bool return "(tobool " + bv + ")"; |
boolean | toBool(String str) Returns a boolean representation of the provided string switch (str.charAt(0)) { case 't': case 'T': case '1': return true; default: return false; |
boolean | toBool(String str) to Bool if (!str.toLowerCase().equals("false") && !str.toLowerCase().equals("true")) throw new NumberFormatException("Can't convert '" + str + "' to bool"); return Boolean.parseBoolean(str); |
boolean | toBool(String v, boolean def) Converts specified string to boolean. if (v == null) return def; return v.equalsIgnoreCase("TRUE") || v.equalsIgnoreCase("YES") || v.equalsIgnoreCase("1") || v.equalsIgnoreCase("ON"); |
boolean | toBool(String val) to Bool val = val.toLowerCase(); return (val.equals("1") || val.equals("on") || val.equals("yes")); |
boolean | toBool(String val, boolean def) to Bool if (val == null) { return def; if (val.equalsIgnoreCase("Y") || val.equalsIgnoreCase("T")) { return true; } else if (val.equalsIgnoreCase("N") || val.equalsIgnoreCase("F")) { return false; } else { ... |