Name: skT88420 Date: 07/13/99
java.lang.boolean currently has no method to directly convert from a string to a (primitive) boolean. It would be helpful to have a parseBoolean(string) method, similar to the parseInt(string) method provided in java.lang.Integer and the parseLong(string) method provided in java.lang.Long(string).
(Review ID: 85546)
======================================================================
Name: rmT116609 Date: 08/21/2001
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
J2SE has Byte.parseByte, Double.parseDouble, Float.parseFloat, Integer.parseInt, Long.parseLong, and Short.parseShort, but no Boolean.parseBoolean. It is tedious and ugly to have to write code that looks like this:
boolean bUseDate = Boolean.valueOf(strUseDate).booleanValue();
when what you really want to do is this:
boolean bUseDate = Boolean.parseBoolean(strUseDate);
Boolean.parseBoolean should look like this:
public static boolean parseBoolean(String s);
Parses the string argument as a boolean. The Boolean returned represents the
value true if the string argument is not null and is equal, ignoring case,
to the string "true".
Example: Boolean.parseBoolean("True") returns true.
Example: Boolean.parseBoolean("yes") returns false.
Parameters:
s - a string.
Returns:
the boolean primitive represented by the string.
(Review ID: 130392)
======================================================================