@ SuppressWarnings ( { "SimplifiableIfStatement" } ) public static boolean validBooleanString ( String boolString ) { if ( boolString == null ) return false ; Matcher m = VALID_CHARACTERS_FOR_BOOLEAN_STRING_PATTERN . matcher ( boolString ) ; if ( ! m . matches ( ) ) return false ; return boolString . equalsIgnoreCase ( "true" ) || boolString . equalsIgnoreCase ( "false" ) ; }
Return true if the given String is true or false ignoring case .