aspose file tools*
The moose likes Java in General and the fly likes Regarding String to Boolean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Regarding String to Boolean" Watch "Regarding String to Boolean" New topic
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: 10535
    
    9

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.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3742
    
  16
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding String to Boolean