ASP字符串转换为整形、双精度型、布尔
ASP字符串转换为整形、双精度型、布尔
发布时间:2016-12-29 来源:查字典编辑
摘要:Rem将字符串转换为整形数据functiontoInteger(str,num)str=trim(str)ifstr=""ornotisnu...

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

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新ASP教程学习
热门ASP教程学习
编程开发子分类