Java Boolean From toBool(String val, boolean def)

Here you can find the source of toBool(String val, boolean def)

Description

to Bool

License

Open Source License

Declaration

public static boolean toBool(String val, boolean def) 

Method Source Code

//package com.java2s;

public class Main {
    public static boolean toBool(String val, boolean def) {
        if (val == null) {
            return def;
        }/*  w ww  .j a  v  a2 s  .c  om*/
        if (val.equalsIgnoreCase("Y") || val.equalsIgnoreCase("T")) {
            return true;
        } else if (val.equalsIgnoreCase("N") || val.equalsIgnoreCase("F")) {
            return false;
        } else {
            return def;
        }
    }
}

Related

  1. toBool(String bv)
  2. toBool(String str)
  3. toBool(String str)
  4. toBool(String v, boolean def)
  5. toBool(String val)
  6. toBoolean(boolean b)
  7. toBoolean(Boolean bool)
  8. toBoolean(Boolean bool)
  9. toBoolean(boolean bool)