UCE Docs / to_bool

Signature

bool to_bool(String s, bool fallback = false)

Parameters

s : string to parse
fallback : value returned when s is empty or not a recognized boolean token
return value : parsed bool, or fallback.

Parses a trimmed, case-insensitive boolean string.

Truthy tokens are "1", "true", "yes", and "on". Falsey tokens are "0", "false", "no", and "off". Empty or unrecognized strings return the fallback.

Example

print(to_bool("yes") ? "true\n" : "false\n");
Output
true