Java Boolean From toBoolean(String input, boolean defaultValue)

Here you can find the source of toBoolean(String input, boolean defaultValue)

Description

to Boolean

License

Apache License

Declaration

public static boolean toBoolean(String input, boolean defaultValue) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static boolean toBoolean(String input, boolean defaultValue) {
        if (input == null) {
            return defaultValue;
        }//from  w  w w  .ja v a 2 s.c o m
        try {
            return Boolean.valueOf(input).booleanValue();
        } catch (Exception e) {
            return defaultValue;
        }
    }
}

Related

  1. toBoolean(Object value, Boolean defaultValue)
  2. toBoolean(Object value, boolean defaultValue)
  3. toBoolean(String baseString)
  4. toBoolean(String content)
  5. toBoolean(String flag)
  6. toBoolean(String inString)
  7. toBoolean(String propertyValue)
  8. toBoolean(String s)
  9. toBoolean(String s)