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

—-想了解更多的linux相关异常处理怎么解决关注<计算机技术网(www.ctvol.com)!!>



本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/htmltutorial/75600.html

(0)
上一篇 2020年4月20日
下一篇 2020年4月20日

精彩推荐