JavaScript

$u.s.toBool Function

Syntax

$u.s.toBool(str as string)

Arguments

str string

The string to convert into a boolean.

Description

Convert a string into a logical. If a string is one of the following values (case insensitive), it is converted to true: true, t, yes, 1, .t.. Any other value is false.

Example

/*Assume that the page has in input control called 'married' in  which
a user might have typed 'Yes'*/
var isMarried = $u.s.toBool($gvs('married'));