ParseStringAsBoolean

Typestatement
DictionaryLCB
LibraryLiveCode Builder
Syntax
parse <Operand> as boolean
Associationscom.livecode.logic
Summary

Parses a string as a boolean value

Parameters
NameTypeDescription
Operand

An expression that evaluates to a string.

Example
variable tString as String
variable tBool as optional Boolean
combine ["f", "a", "l", "s" "e"] with "" into tString
put tString parsed as boolean into tBool -- tBool contains false
variable tResult as String
variable tCheck as optional Boolean
parse "sdfsdf" as boolean into tCheck
if tCheck is nothing then
	put "not a valid boolean" into tResult
end if
Values
NameTypeDescription
return

true or false

Description

Use StringParsedAsBoolean when you want to determine if a string contains "true" or "false"

Note: Only the strings "true" and "false" will parse to give a boolean value. Any other input will cause an error to be thrown.