Here you can find the source of toBoolean(String value, boolean dEfault)
value
is "true", then true
is returned.
public static boolean toBoolean(String value, boolean dEfault)
//package com.java2s; /**//from w ww . j a va2 s .c om * Logback: the reliable, generic, fast and flexible logging framework. * Copyright (C) 1999-2013, QOS.ch. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by * the Eclipse Foundation * * or (per the licensee's choosing) * * under the terms of the GNU Lesser General Public License version 2.1 * as published by the Free Software Foundation. */ public class Main { /** * If <code>value</code> is "true", then <code>true</code> is returned. If * <code>value</code> is "false", then <code>true</code> is returned. * Otherwise, <code>default</code> is returned. * <p/> * <p> Case of value is unimportant. */ public static boolean toBoolean(String value, boolean dEfault) { if (value == null) { return dEfault; } String trimmedVal = value.trim(); if ("true".equalsIgnoreCase(trimmedVal)) { return true; } if ("false".equalsIgnoreCase(trimmedVal)) { return false; } return dEfault; } }