String.toBoolean
toBoolean()
Description
Convert to Boolean type. Surrounding whitespace is ignored.
The following values are false
: ''
, 'false'
, 'null'
, and '0'
.
All other values are true
.
'1'.toBoolean(); //= true '0'.toBoolean(); //= false ' true'.toBoolean(); //= true ' false'.toBoolean(); //= false