asp 空值測試判斷函數,學習asp的朋友可以參考下。
複製代碼代碼如下:
'函數:空值測試
Function inull(Val)
Dim tmp
tmp = False
If IsNull(Val) Then
tmp = True
ElseIf IsEmpty(Val) Then
tmp = True
ElseIf Trim(Val) = Then
tmp = True
End If
inull = tmp
End Function
測試變數是否為空值,空值的意義包括:變數不存在/為空,物件為Nothing,0,空數組,字串為空
Function IsBlank(ByRef Var)
IsBlank = False
Select Case True
Case IsObject(Var)
If Var Is Nothing Then IsBlank = True
Case IsEmpty(Var), IsNull(Var)
IsBlank = True
Case IsArray(Var)
If UBound(Var) = 0 Then IsBlank = True
Case IsNumeric(Var)
If (Var = 0) Then IsBlank = True
Case Else
If Trim(Var) = Then IsBlank = True
End Select
End Function