ASP字符串轉(zhuǎn)換為整形、雙精度型、布爾
更新時(shí)間:2008年05月15日 23:28:40 作者:
asp可以輕松將字符串類(lèi)型轉(zhuǎn)化為其它類(lèi)型的函數(shù)
Rem 將字符串轉(zhuǎn)換為整形數(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 將字符串轉(zhuǎn)換為雙精度型數(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 將字符串轉(zhuǎn)換為布爾數(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 將字符串轉(zhuǎn)換為雙精度型數(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 將字符串轉(zhuǎn)換為布爾數(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
相關(guān)文章
推薦的用Asp實(shí)現(xiàn)屏蔽IP地址訪問(wèn)的代碼
推薦的用Asp實(shí)現(xiàn)屏蔽IP地址訪問(wèn)的代碼...2007-08-08
asp 讀取通過(guò)表單發(fā)送的post數(shù)據(jù)
學(xué)習(xí)ASP,最重要的就是要掌握ASP內(nèi)置的六大對(duì)象,如果以前沒(méi)接觸過(guò),聰明的您就不要管這些概念了,知道怎么用就行了,我的觀點(diǎn)是剛開(kāi)始關(guān)鍵在于臨摹2012-12-12
isnumeric檢測(cè)是否為數(shù)字類(lèi)型的asp代碼
ASP判斷是否為數(shù)字通常用isnumeric()函數(shù),它的作用是判斷里面的參數(shù)表達(dá)式是不是數(shù)值2007-11-11
轉(zhuǎn)換中文為unicode 轉(zhuǎn)換unicode到正常文本
轉(zhuǎn)換中文為unicode 轉(zhuǎn)換unicode到正常文本...2006-10-10
在asp中通過(guò)vbs類(lèi)實(shí)現(xiàn)rsa加密與解密的代碼
在asp中通過(guò)vbs類(lèi)實(shí)現(xiàn)rsa加密與解密的代碼...2007-03-03
asp中response.write(''中文'')或者js中文亂碼問(wèn)題
這篇文章主要介紹了asp中response.write('中文')或者js中文亂碼問(wèn)題,有時(shí)候我們需要輸出js也會(huì)出現(xiàn)亂碼,這里給出了幾個(gè)解決方法,需要的朋友可以參考下2020-03-03
ASP操作Excel相關(guān)技術(shù)總結(jié)
ASP操作Excel相關(guān)技術(shù)總結(jié)...2007-05-05
ASP中Server.Execute和Execute實(shí)現(xiàn)動(dòng)態(tài)包含(include)腳本的區(qū)別
ASP中Server.Execute和Execute實(shí)現(xiàn)動(dòng)態(tài)包含(include)腳本的區(qū)別,需要的朋友可以參考下。2012-01-01

