Java Boolean From toBool(String str)

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

Description

to Bool

License

Open Source License

Declaration

public static boolean toBool(String str) 

Method Source Code

//package com.java2s;
/** Copyright ? 2015 Holger Steffan H.St. Soft
 * //  www  . j  a v  a  2s.  co  m
 * This file is subject to the terms and conditions defined in file 'license', which is part of this source code
 * package. */

public class Main {
    public static boolean toBool(String str) {
        if (!str.toLowerCase().equals("false") && !str.toLowerCase().equals("true"))
            throw new NumberFormatException("Can't convert '" + str + "' to bool");
        return Boolean.parseBoolean(str);
    }
}

Related

  1. toBool(Boolean obj)
  2. toBool(int[] data, int index)
  3. toBool(long l)
  4. toBool(String bStr)
  5. toBool(String bv)
  6. toBool(String str)
  7. toBool(String v, boolean def)
  8. toBool(String val)
  9. toBool(String val, boolean def)