类型:转载 责任编辑:asp 日期:2007/03/01
strtoint()是把字符转换成整型,那把字符转换成布尔型怎么转换?
推荐阅读
unit
sysutils
function strtobool(const s: string): boolean
多看看帮助~
description
strtobool converts the string specified by s to a boolean. if s can be converted to a number, strtobool returns false if that number is 0, true otherwise. if s can抰 be converted to a number, strtobool returns true if s is any of the strings listed in trueboolstrs (or differs from one only by case) and false if it is any of the strings listed in falseboolstrs (or differs from one only by case). if s is not a number and not one of the strings listed in trueboolstrs or falseboolstrs, strtobool raises an econverterror exception.
note: if you do not assign a value to trueboolstrs, it is treated as if it contains the single string 慣rue? similarly, if you do not assign a value to falseboolstrs, it is treated as if it contains the single string 慒alse?
description
strtobool converts the string specified by s to a boolean. if s can be converted to a number, strtobool returns false if that number is 0, true otherwise. if s can抰 be converted to a number, strtobool returns true if s is any of the strings listed in trueboolstrs (or differs from one only by case) and false if it is any of the strings listed in falseboolstrs (or differs from one only by case). if s is not a number and not one of the strings listed in trueboolstrs or falseboolstrs, strtobool raises an econverterror exception.
note: if you do not assign a value to trueboolstrs, it is treated as if it contains the single string true similarly, if you do not assign a value to falseboolstrs, it is treated as if it contains the single string false.