ASP 三层架构 Convert类实现代码(3)


Else
select case Asc(Mid(value0, i, 1))
case Asc("-")
if i=1 then
else
IsDecimal = false
Exit For
end if
case Asc(".")
if intDecimalCount<2 then
intDecimalCount=intDecimalCount + 1
else
IsDecimal = false
Exit For
end if
case else
IsDecimal = false
Exit For
end select
End If
Next
end if
End Function
' ****** check if Value is in range of Decimal
' Only use in this class
' Value :
' vBound :
Private Function IsOverflowDecimal(ByVal Value,ByVal vBound)
if Trim(Value)="" or IsNull(Value) or IsEmpty(Value) or Trim(vBound)="" or IsNull(vBound) or IsEmpty(vBound) then
IsOverflowDecimal=true
else
end if
End Function
Public Function IsSng(ByVal Value)
IsSng=IsDecimal(value)
' -340282300000000000000000000000000000000 ~ -0.000000000000000000000000000000000000000000001401298
' 0.000000000000000000000000000000000000000000001401298 ~ 340282300000000000000000000000000000000
' -3.402823 E38 ~ -1.401298 E-45
' 1.401298 E-45 ~ 3.402823 E38
End Function
Public Function IsDbl(ByVal Value)
IsDbl=IsDecimal(value)
' -1.79769313486232 E308 ~ -4.94065645841247 E-324
' 4.94065645841247 E-324 ~ 1.7976931348623 E308
End Function
Public Function IsCur(ByVal Value)
IsCur=IsDecimal(value)
'-922337203685477.5808 ~ 922337203685477.5807
End Function
Public Function IsBln(ByVal Value)
if Value=true or Value=false or trim(Value)="1" or trim(Value)="0" then
IsBln=true
else
IsBln=false
end if
End Function
Public Function IsDat(ByVal Value)
if Trim(Value)="" or IsNull(Value) or IsEmpty(Value) then
IsDat=false
else
IsDat=IsDate(Value)
end if
End Function
Public Function IsArr(ByVal Value)
if Trim(Value)="" or IsNull(Value) or IsEmpty(Value) then
IsArr=false
else
IsArr=IsArray(Value)
end if
End Function
' ==============================================================================
' Convert Type, Return value/initial value
' ==============================================================================
Public Function ToStr(ByVal Value)
ToStr=trim(Value)
End Function
Public Function ToInt(ByVal Value)
if IsInt(Value) then
ToInt=Cint(Value)
else
ToInt=0
end if
End Function
Public Function ToLng(ByVal Value)
if IsLng(Value) then
ToLng=clng(Value)
else
ToLng=0
end if
End Function
Public Function ToSng(ByVal Value)
if IsSng(Value) then
ToSng=cSng(Value)
else
ToSng=0
end if
End Function
Public Function ToDbl(ByVal Value)
if IsDbl(Value) then
ToDbl=cDbl(Value)
else
ToDbl=0
end if
End Function
Public Function ToBln(ByVal Value)
if IsBln(Value) then
ToBln=cbool(Value)
else
ToBln=false
end if
End Function
' ****** vDecimal : number of decimal places
Public Function ToCur(ByVal Value)
if IsCur(Value) then
ToCur=ccur(Value)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2112.html