Java Boolean From toBoolean(String inString)

Here you can find the source of toBoolean(String inString)

Description

to Boolean

License

BSD License

Declaration

public static boolean toBoolean(String inString) 

Method Source Code

//package com.java2s;
/*L//from   w ww.  j a va2s .c  o m
 * Copyright Oracle inc, SAIC-F
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.com/cadsr-util/LICENSE.txt for details.
 */

public class Main {
    public static boolean toBoolean(String inString) {
        boolean retVal = false;
        if (inString.toUpperCase().equals("Y") || inString.toUpperCase().equals("TRUE")
                || inString.equalsIgnoreCase("Yes")) {
            retVal = true;
        } else if (inString.toUpperCase().equals("N") || inString.toUpperCase().equals("FALSE")
                || inString.equalsIgnoreCase("No")) {
            retVal = false;
        }
        return retVal;
    }
}

Related

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