Here you can find the source of toBoolean(String baseString)
public static final boolean toBoolean(String baseString)
//package com.java2s; /**/*from w w w. ja v a2 s .c o m*/ * Converts a line of text into an array of lower case words using a * BreakIterator.wordInstance(). * <p> * * This method is under the Jive Open Source Software License and was written * by Mark Imbriaco. * * @param text * a String of text to convert into an array of words * @return text broken up into an array of words. */ public class Main { public static final boolean toBoolean(String baseString) { return toBoolean(baseString, true); } public static final boolean toBoolean(String baseString, boolean pbDeault) { if (baseString == null) return pbDeault; else if (equalsIgnoreCase(baseString, "yes") || equalsIgnoreCase(baseString, "true") || equalsIgnoreCase(baseString, "on") || equalsIgnoreCase(baseString, "y") || equalsIgnoreCase(baseString, "1")) return true; else if (equalsIgnoreCase(baseString, "no") || equalsIgnoreCase(baseString, "false") || equalsIgnoreCase(baseString, "off") || equalsIgnoreCase(baseString, "n") || equalsIgnoreCase(baseString, "0")) return false; else return pbDeault; } public static final boolean equalsIgnoreCase(String baseString, String param1) { if (baseString == null) { if (param1 == null) return true; else return false; } else return baseString.equalsIgnoreCase(param1); } }