Java Boolean Value From convertBoolean(String str)

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

Description

convert Boolean

License

Open Source License

Declaration

public static boolean convertBoolean(String str) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean convertBoolean(String str) {
        return convertBoolean(str, false);
    }/*from   w w  w.j av a 2  s .  com*/

    public static boolean convertBoolean(String value, boolean defaultValue) {
        if (value == null)
            return defaultValue;

        value = value.trim().toUpperCase();
        return value.equals("1") || value.equals("TRUE") || value.equals("YES") || value.equals("T")
                || value.equals("Y");
    }
}

Related

  1. booleanValueOf(Object obj)
  2. booleanValueWithYN(String string)
  3. convertBoolean(Boolean convertedValue, boolean defaultValue)
  4. convertBoolean(final String value)
  5. convertBoolean(Object o)
  6. convertBoolean(String str, boolean defaults)
  7. convertBoolean(String value)
  8. convertBoolean(String value)
  9. convertBoolean2boolean(final Boolean[] pArray)