What’s the utility method that parses a boolean String properly? By properly I mean
"true" => true
"false" => false
"foo" => error
The parse methods in java.lang.Boolean are dodgy – they don’t distinguish “false” from “foo”. Anything else in Java libraries (or Guava, or Commons Lang) that does it properly?
Yes it’s just be a couple lines, I just rather not write any line that I shouldn’t have to. 🙂
Check out Boolean Utils form apache commons :
Boolean Utils API