Here you can find the source of asBoolean(String str)
public static boolean asBoolean(String str)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean asBoolean(String str) { if (str == null || str.length() == 0) return false; str = str.trim();/* ww w.j a v a 2 s .c om*/ if ("1".equals(str)) return true; str = str.toLowerCase(); return "true".equals(str) || "yes".equals(str) || "y".equals(str) || "on".equals(str) || "ja".equals(str) || "enable".equals(str); } public static String toLowerCase(final String s) { return hasUpperLetter(s) ? s.toLowerCase() : s; } public static boolean hasUpperLetter(final CharSequence s) { int len; if (null != s && (len = s.length()) != 0) while (len > 0) if (Character.isUpperCase(s.charAt(--len))) return true; return false; } }