Results 1 to 9 of 9
Thread: Casting a string to boolean
May 24, 2007, 08:59 #1
- Join Date
- Jan 2005
- Too far up north
- 0 Post(s)
- 0 Thread(s)
Casting a string to boolean
Lets say that we have a String with the value "false" or "true". Lets now cast this String to a boolean value. In Java it would be
The above will only be false if false, NaN, null, 0 or an empty String is provided, everything else will return true.
So the only way to cast a String with the values "true" or "false" is to use eval...
var snowing = eval("false");
Anybody has another way to do the cast?