首页 > 代码库 > java Boolean.valueOf(str)

java Boolean.valueOf(str)

java中Boolean源码


//String 转boolean
public static Boolean valueOf(String s) {
      return toBoolean(s) ? TRUE : FALSE;

}


private static boolean toBoolean(String name) {
      return ((name != null) && name.equalsIgnoreCase("true"));

}


//boolean 转 String

public static String toString(boolean b) {
      return b ? "true" : "false";

}


public String toString() {
           return value ? "true" : "false";
}


java Boolean.valueOf(str)