; ---------------------------------------------------------------------- ; -- Blitz_Basic_Bool.bb ; -- ; -- Converts a string to a boolean value (true or false) ; -- ; -- Version : 1.0 ; -- Licence : Public Domain ; ---------------------------------------------------------------------- ;;; Converts a string to a boolean value. ;;; The string to convert. ;;; The default value to return if the string is not valid. ;;; True or False. ;;; Blitz.Basic Function Bool(boolString$, defaultValue = False) Local boolValue = defaultValue Select Lower(boolString$) Case "true" : boolValue = True Case "false": boolValue = False Case "1" : boolValue = True Case "0" : boolValue = False End Select Return boolValue End Function ;;; Converts an integer value to its textual boolean value. ;;; The value to convert. ;;; The string "True" if boolValue is greater than 0, else returns "False". ;;; Blitz.Basic Function BoolStr$(boolValue%) If boolValue > 0 Then Return "True" Else Return "False" EndIf End Function