flexr

Archive for August 2008

Parse Boolean method for Flex

with one comment

I wonder why there isn’t an out of the box Boolean parser in Flex, I must have built this same method at least 3 times for different projects… You should probably add this to your utils as well.

static public function parseBoolean(str:String):Boolean {
switch(str) {
case "1":
case "true":
case "yes":
return true;
case "0":
case "false":
case "no":
return false;
default:
return Boolean(str);
}
}

Written by Jester theFool

August 12, 2008 at 11:59 pm