Here you can find the source of asBoolean(String value)
public static boolean asBoolean(String value)
//package com.java2s; /**//from w w w.j a v a2s. c o m * Copyright (c) 2013-2014 Angelo ZERR. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Angelo Zerr <angelo.zerr@gmail.com> - initial API and implementation */ public class Main { public static final String TRUE = "true"; public static final String FALSE = "false"; public static final String YES = "yes"; public static final String NO = "no"; public static boolean asBoolean(String value) { return asBoolean(value, false); } public static boolean asBoolean(String value, boolean defaultValue) { if (value == null) return defaultValue; value = value.trim(); if (defaultValue) return !(FALSE.equals(value.toLowerCase()) || NO.equals(value.toLowerCase())); return TRUE.equals(value.toLowerCase()) || YES.equals(value.toLowerCase()); } }