ASP字符串轉(zhuǎn)換為整形、雙精度型、布爾
更新時(shí)間:2008年05月15日 23:28:40 作者:
asp可以輕松將字符串類型轉(zhuǎn)化為其它類型的函數(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)文章
談動(dòng)態(tài)多行多列,循環(huán)行和列,輸出M行N列的ASP代碼
2008-03-03ASP中怎么實(shí)現(xiàn)SQL數(shù)據(jù)庫(kù)備份、恢復(fù)!
ASP中怎么實(shí)現(xiàn)SQL數(shù)據(jù)庫(kù)備份、恢復(fù)!...2007-03-03C語(yǔ)言數(shù)組添加和刪除元素的實(shí)現(xiàn)
這篇文章主要介紹了C語(yǔ)言數(shù)組添加和刪除元素的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-02-02DefiniteUrl asp將相對(duì)地址轉(zhuǎn)換為絕對(duì)地址的代碼
DefiniteUrl asp將相對(duì)地址轉(zhuǎn)換為絕對(duì)地址的代碼...2007-09-09ASP 下載時(shí)重命名已上傳文件的新下載文件名的實(shí)現(xiàn)代碼
標(biāo)題有點(diǎn)拗口,今天群里在說(shuō)這個(gè)問(wèn)題,CSDN有答案,附上,需要的朋友可以參考下2012-03-03asp HTTP 500錯(cuò)誤 常見(jiàn)問(wèn)題分析
這個(gè)問(wèn)題一般錯(cuò)誤不是很大,大家可以參考下面的步驟解決。2009-03-03