Java String to Boolean asBoolean(String s)

Here you can find the source of asBoolean(String s)

Description

as Boolean

License

Apache License

Declaration

private static Boolean asBoolean(String s) 

Method Source Code

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

public class Main {
    private static Boolean asBoolean(String s) {
        if (s.equalsIgnoreCase("true")) {
            return Boolean.TRUE;
        } else if (s.equalsIgnoreCase("false")) {
            return Boolean.FALSE;
        } else {/*from  w  w w.ja v  a  2 s. co m*/
            return null;
        }
    }
}

Related

  1. asBoolean(String flag)
  2. asBoolean(String name, boolean value)
  3. asBoolean(String str)
  4. asBoolean(String string)
  5. asBoolean(String value)
  6. asBoolean(String value, boolean defaultValue)