Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

convert string true to boolean true javascript

stringToBoolean: function(string){
    switch(string.toLowerCase().trim()){
        case "true": case "yes": case "1": return true;
        case "false": case "no": case "0": case null: return false;
        default: return Boolean(string);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #string #true #boolean #true #javascript
ADD COMMENT
Topic
Name
8+7 =