TABLE OF CONTENTS
::pwtk::is_true
SYNOPSIS
proc ::pwtk::is_true {value} {
PURPOSE
Return 1 if the supplied $value is one of 1, TRUE, T, .TRUE., .T., YES, or ON (case insensitive). Return 0 otherwise.
SOURCE
set value [string trim $value .] switch -nocase -- $value { true - t - yes - on - 1 { return 1 } } # perhaps $value is expression if { [is_expr $value] } { set value [expr $value] } # positive integer values are considered as true if { [string is integer -strict $value] } { if { $value > 0 } { return 1 } } # boolean ? if { [string is boolean -strict $value] } { if { $value } { return 1 } else { return 0 } } return 0 }