Just as {@link #toBoolean(String)}, except that true will be returned if str = null when {@code trueIfNull} is
true, false otherwise.
481623
public static final boolean toBoolean(String str, boolean trueIfNull) {
        if (str == null && trueIfNull) {
            return true;
        }

        return toBoolean(str);
    }
661321
@Override
    public boolean toBoolean(Object val) {
        if (val == null) {
            controlNullOperand();
            return false;
        } else if (val instanceof Boolean) {
            return (Boolean) val;
        } else if (val instanceof Number) {
            double number = toDouble(val);
            return !Double.isNaN(number) && number != 0.d;
        } else if (val instanceof String) {
            String strval = val.toString();
            return strval.length() > 0 && !"false".equals(strval);
        } else if (val instanceof Collection) {
            return CollectionUtils.isNotEmpty((Collection) val);
        }

        return true;
    }
447441
public boolean parseBooleanString(String booleanString) {
        StringReader sr = new StringReader(booleanString);
        StreamTokenizer st = new StreamTokenizer(sr);
        boolean value = false;
        int tokenType;
        try {
            tokenType = st.nextToken();
            if (tokenType == StreamTokenizer.TT_WORD) {
                if (st.sval.equalsIgnoreCase("true"))
                    value = true;
            }
        } catch (IOException e) {
            Log.e(TAG, "Boolean Error: " + e);
            e.printStackTrace();
        }
        return value;
    }
374780
public static Boolean toBoolean(Object o) throws PageException {
	if (o instanceof Boolean) return (Boolean) o;
	return toBooleanValue(o) ? Boolean.TRUE : Boolean.FALSE;

    }
942318
public static boolean toBoolean(String valueStr) {
		if (StrUtil.isNotBlank(valueStr)) {
			valueStr = valueStr.trim().toLowerCase();
			if (ArrayUtil.contains(TRUE_ARRAY, valueStr)) {
				return true;
			}
		}
		return false;
	}
665168
function toBoolean(arg){
	if ( !arg ) return false;
	if ( typeof arg !== 'string' ) return true;
	return !/^(0|false|f|no|n)$/i.test((arg + '').trim());
}
1164878
@Override
    public boolean getBoolean(int columnIndex) throws SQLException {
        checkColumnBounds(columnIndex);
        // TODO: Tempting to apply a != 0 operation on numbers and
        // .equals("true") on strings, but... hacky
        try {
            return (new Long(table.getLong(columnIndex - 1))).intValue() == 1;
        } catch (Exception x) {
            throw SQLError.get(x);
        }
    }
1374424
def _isbool(string):
    
    return isinstance(string, _bool_type) or\
        (isinstance(string, (_binary_type, _text_type))
         and
         string in ("True", "False"))
859942
public static boolean isBoolean(String number) {
        boolean result = false;
        if (number != null && (number.equalsIgnoreCase("true") || number.equalsIgnoreCase("false"))) {
            result = true;
        }
        return result;
    }
399368
public static Boolean parseBoolean(String value) throws ParseException
   {
      Boolean result = null;
      Integer number = parseInteger(value);
      if (number != null)
      {
         result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
      }

      return result;
   }
261713
@SuppressFBWarnings(value = "NP_BOOLEAN_RETURN_NULL", justification = "That's the point (but dubious)")
    public static Boolean falseToNull(Boolean bool) {
        if (bool != null && bool) {
            return true;
        }
        return null;
    }
888761
public static boolean getBoolean(JSONValue value) {
        if (value == null)
            return false;
        if (!(value instanceof JSONBoolean))
            throw new JSONException(NOT_A_BOOLEAN);
        return ((JSONBoolean)value).booleanValue();
    }
640554
public static boolean toBoolean(Object obj, boolean defaultValue) {

        if (obj == null) {
            return defaultValue;
        }

        if (obj instanceof Boolean) {
            return ((Boolean) obj).booleanValue();
        } else if (obj instanceof Number || obj.getClass().isPrimitive()) {
            int value = toInt(obj);
            return value != 0 ? true : false;
        } else if (obj instanceof Value) {
            return ((Value) obj).booleanValue();
        } else if (obj instanceof String || obj instanceof CharSequence) {
            String str = Conversions.toString(obj);
            if (str.length() == 0) {
                return false;
            }
            if (str.equals("false")) {
                return false;
            } else {
                return true;
            }
        } else if (isArray(obj)) {
            return len(obj) > 0;
        } else if (obj instanceof Collection) {

            if (len(obj) > 0) {
                List list = Lists.list((Collection) obj);
                while (list.remove(null)) {

                }
                return Lists.len(list) > 0;
            } else {
                return false;
            }
        } else {
            return toBoolean(Conversions.toString(obj));
        }
    }
674857
public Boolean getAsBoolean() {
		if (value instanceof String) {
			return Boolean.parseBoolean((String)value);
		}
		return (Boolean)value;
	}
952199
public static boolean getBoolean(String key, boolean defaultValue) {
		String value = get(key);
		if (value == null) {
			return defaultValue;
		}

		value = value.trim().toLowerCase();
		if (value.isEmpty()) {
			return true;
		}

		if ("true".equals(value) || "yes".equals(value) || "1".equals(value)) {
			return true;
		}

		if ("false".equals(value) || "no".equals(value) || "0".equals(value)) {
			return false;
		}

		return defaultValue;
	}
1067621
public static String checkNull(String value, String elseValue) {
        return isNull(value) ? elseValue : value;
    }
1365484
Boolean getBooleanAttribute(org.w3c.dom.Node attribute)  {
    String s = getStringAttribute(attribute);

    if (s == null) {
      return null;
    }

    return Boolean.parseBoolean(s);
  }