ASP字符串轉換為整形、雙精度型、布爾
更新時間:2008年05月15日 23:28:40 作者:
asp可以輕松將字符串類型轉化為其它類型的函數(shù)
Rem 將字符串轉換為整形數(shù)據(jù)
function toInteger(str,num)
str=trim(str)
if str="" or not isnumeric(str) then
toInteger=num
else
toInteger=clng(str)
end if
end function
Rem 將字符串轉換為雙精度型數(shù)據(jù)
function toDouble(str)
str=trim(str)
if str="" or not isnumeric(str) then
toDouble=0.0
else
toDouble=cdbl(str)
end if
end function
Rem 將字符串轉換為布爾數(shù)據(jù)
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
function toInteger(str,num)
str=trim(str)
if str="" or not isnumeric(str) then
toInteger=num
else
toInteger=clng(str)
end if
end function
Rem 將字符串轉換為雙精度型數(shù)據(jù)
function toDouble(str)
str=trim(str)
if str="" or not isnumeric(str) then
toDouble=0.0
else
toDouble=cdbl(str)
end if
end function
Rem 將字符串轉換為布爾數(shù)據(jù)
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 讀取通過表單發(fā)送的post數(shù)據(jù)
學習ASP,最重要的就是要掌握ASP內(nèi)置的六大對象,如果以前沒接觸過,聰明的您就不要管這些概念了,知道怎么用就行了,我的觀點是剛開始關鍵在于臨摹2012-12-12
在asp中通過vbs類實現(xiàn)rsa加密與解密的代碼
在asp中通過vbs類實現(xiàn)rsa加密與解密的代碼...2007-03-03
asp中response.write(''中文'')或者js中文亂碼問題
這篇文章主要介紹了asp中response.write('中文')或者js中文亂碼問題,有時候我們需要輸出js也會出現(xiàn)亂碼,這里給出了幾個解決方法,需要的朋友可以參考下2020-03-03
ASP中Server.Execute和Execute實現(xiàn)動態(tài)包含(include)腳本的區(qū)別
ASP中Server.Execute和Execute實現(xiàn)動態(tài)包含(include)腳本的區(qū)別,需要的朋友可以參考下。2012-01-01

