Here you can find the source of toBoolean(final String s)
Parameter | Description |
---|---|
s | A boolean string equivalent |
public static boolean toBoolean(final String s)
//package com.java2s; /*L/*from w ww. ja v a 2s .c o m*/ * Copyright RTI International * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/webgenome/LICENSE.txt for details. */ public class Main { /** * Convert a string into a boolean primitive * (i.e. {"true","yes"} -> true). * @param s A boolean string equivalent * @return A boolean value */ public static boolean toBoolean(final String s) { String temp = s.toUpperCase(); return "TRUE".equals(temp) || "YES".equals(temp) || "ON".equals(temp); } }