Rem将字符串转换为整形数据
functiontoInteger(str,num)
str=trim(str)
ifstr=""ornotisnumeric(str)then
toInteger=num
else
toInteger=clng(str)
endif
endfunction
Rem将字符串转换为双精度型数据
functiontoDouble(str)
str=trim(str)
ifstr=""ornotisnumeric(str)then
toDouble=0.0
else
toDouble=cdbl(str)
endif
endfunction
Rem将字符串转换为布尔数据
functiontoBoolean(str)
str=lcase(trim(str))
ifstr="true"orstr="t"then
toBoolean=true
elseifisnumeric(str)then
ifclng(str)<>0thentoBoolean=true
else
toBoolean=false
endif
endfunction
