In Java you can write Boolean.valueOf(myString)
. However in Scala, java.lang.Boolean
is hidden by scala.Boolean
which lacks this function. It's easy enough to switch to using the original Java version of a boolean, but that just doesn't seem right.
So what is the one-line, canonical solution in Scala for extracting "true" from a string?