Java Boolean Value From booleanValueWithYN(String string)

Here you can find the source of booleanValueWithYN(String string)

Description

This method is to convert a boolean value with a y or n string.

License

Open Source License

Parameter

Parameter Description
string String The string to be judged

Return

boolean

Declaration

public static boolean booleanValueWithYN(String string) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w ww. j  a v a2 s. c  om
     * This method is to convert a boolean value with a y or n string.
     * 
     * @param string String The string to be judged
     * @return boolean
     */
    public static boolean booleanValueWithYN(String string) {
        if (string == null) {
            return false;
        }
        return string.equalsIgnoreCase("YES") || string.equalsIgnoreCase("y");
    }
}

Related

  1. booleanValue(String tfString)
  2. booleanValue(String tfString)
  3. booleanValue(String tfString)
  4. booleanValueOf(boolean b)
  5. booleanValueOf(Object obj)
  6. convertBoolean(Boolean convertedValue, boolean defaultValue)
  7. convertBoolean(final String value)
  8. convertBoolean(Object o)
  9. convertBoolean(String str)