Java Boolean From toBooleanTrue(String str)

Here you can find the source of toBooleanTrue(String str)

Description

Only str is "off", "false", "no" return false, otherwise all true

License

Open Source License

Parameter

Parameter Description
show a parameter

Declaration

public static boolean toBooleanTrue(String str) 

Method Source Code

//package com.java2s;
/* /*from   ww w.j a  v  a  2 s  . c  o m*/
 * =============================================================
 * Copyright (C) 2007-2011 Edgenius (http://www.edgenius.com)
 * =============================================================
 * License Information: http://www.edgenius.com/licensing/edgenius/2.0/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2.0
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * http://www.gnu.org/licenses/gpl.txt
 *  
 * ****************************************************************
 */

public class Main {
    /**
     * Only str is "off", "false", "no" return false, otherwise all true
     * @param show
     * @return
     */
    public static boolean toBooleanTrue(String str) {
        return !"off".equalsIgnoreCase(str) && !"false".equalsIgnoreCase(str) && !"no".equalsIgnoreCase(str);
    }
}

Related

  1. toBooleanObject(int value, int trueValue, int falseValue, int nullValue)
  2. toBooleanObject(String str)
  3. toBooleans(byte[] bytes)
  4. toBooleans(byte[] value, int offset, int num)
  5. toBooleanString(long value)
  6. toBooleanValue(final Object o)
  7. toBooleanValue(Object val)
  8. toBoolStr(boolean b)
  9. toBoolString(Boolean b)