RSS
热门关键字:  虚拟主机技术  vps团购  discuz架构  虚拟主机团购  curl
当前位置 :| 团购首页>网站编程>ASP>

ASP字符串类型转换函数

来源: 作者: 时间:2008-07-29 Tag:asp   字符串   整形   双精度型   布尔   转换   点击:

' 将字符串转换为整形数据
function toInteger(str,num)
        str=trim(str)
        if str="" or not isnumeric(str) then
              toInteger=num
        else
              toInteger=clng(str)
        end if
end function

' 将字符串转换为双精度型数据
function toDouble(str)
       str=trim(str)
       if str="" or not isnumeric(str) then
              toDouble=0.0
      else
              toDouble=cdbl(str)
      end if
end function

' 将字符串转换为布尔数据
function toBoolean(str)
      str=lcase(trim(str))
      if str="true" or str="t" then
            toBoolean=true
     elseif isnumeric(str) then
            if clng(str)<>0 then toBoolean=true
     else
           toBoolean=false
    end if
end function

 


 


    由于各种原因,我们无法获知[ASP字符串类型转换函数]原创作者,如侵犯了您的版权,请您及时联系我们!
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册