Here you can find the source of booleanValue(String tfString)
public static boolean booleanValue(String tfString)
//package com.java2s; /*//from w ww . j a v a2 s . com * Copyright 2001,2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class Main { public static boolean booleanValue(String tfString) { String trimmed = tfString.trim().toLowerCase(); return trimmed.equals("true") || trimmed.equals("t"); } public static String trim(String src, char[] trims) { if (src == null) return null; if (trims == null || trims.length == 0) return src; String pattern = String.valueOf(trims); int begin = 0; int end = src.length() - 1; char c; while (begin < end) { c = src.charAt(begin); if (pattern.indexOf(c) >= 0) begin++; else break; } while (end > begin) { c = src.charAt(end); if (pattern.indexOf(c) >= 0) end--; else break; } return src.substring(begin, end + 1); } public static int indexOf(String[] ss, String s) { return indexOf(ss, s, true); } public static int indexOf(String[] ss, String s, boolean ignoreCase) { int i = -1; if (ss != null && s != null) { i = 0; while (i < ss.length) { if (ignoreCase) if (s.equalsIgnoreCase(ss[i])) break; else if (s.equals(ss[i])) break; i++; } } if (i == ss.length) i = -1; return i; } }