Skip to main content

str_as_bool

Converts a string representation of a boolean value into its corresponding boolean type, supporting common truthy and falsy strings.

def str_as_bool(
val: string
) - > boolean

Converts a string representation of truth into a boolean value.

Parameters

NameTypeDescription
valstringThe string value to be evaluated for truthiness.

Returns

TypeDescription
booleanThe boolean interpretation of the input string; returns True for 'true', '1', 't', 'y', or 'yes', and False otherwise.