| Author |
Regarding String to Boolean
|
surya.raaj prakash
Ranch Hand
Joined: Oct 30, 2009
Posts: 76
|
|
Hi Friends,
why In preceding code it always gives false even i pass null value?
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8430
|
|
From the API docs
The boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string "true".
As you can see, anything else besides "true", including null generates false.
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Joanne Neal
Rancher
Joined: Aug 05, 2005
Posts: 3011
|
|
surya.raaj prakash wrote:why In preceding code it always gives false even i pass null value?
Because that's how the method works. If you pass anything other than a string containing the value "true" (ignoring case) the method returns false.
|
Joanne
|
 |
 |
|
|
subject: Regarding String to Boolean
|
|
|