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.NET本地开发时常见的配置错误及解决方法? 2025-06-10
- ASP.NET自助建站系统的数据库备份与恢复操作指南 2025-06-10
- 个人网站服务器域名解析设置指南:从购买到绑定全流程 2025-06-10
- 个人网站搭建:如何挑选具有弹性扩展能力的服务器? 2025-06-10
- 个人服务器网站搭建:如何选择适合自己的建站程序或框架? 2025-06-10