您的位置:首页 > 其它

Active Directory系列之十:实战操作主机角色转移

2011-12-10 19:48 344 查看
http://www.livebaby.cn/blog/u/meil/archives/2007/ASP-IsNull-IsEmpty.html(转)

说明:set aa=server.createobject("ddd")
isnull 说明指针为空,指针指到一个无效的位置,即对象不存在,
isempty 说明指针指向一个有效位置,但是值为空
1、空字符串

例:

a)Dim strTmp

response.write(strTmp="") ' 返回true

b)response.write(str="") ' 返回 true

c)Dim strTmp
strTmp=""

response.write(strTmp="") ' 返回 true

这几行代码说明ASP中无论是没做过声明的变量还是做个声明但没有赋值的变量ASP都认为是空字符串或叫做零长度字符串。

2、IsEmpty()
如果变量未初始化或显式地设置为 Empty,则函数 IsEmpty 返回 True;
否则函数返回 False。如果 expression 包含一个以上的变量,总返回 False。

例:

a)Dim strTmp

Response.Write(IsEmpty(strTmp)) ' 返回 True

b)Dim strTmp
strTmp = Null
Response.Write(IsEmpty(strTmp)) ' 返回 Flase

c)Dim strTmp

strTmp = Empty

Response.Write(IsEmpty(strTmp)) ' 返回 True

d)Dim strTmp
strTmp = ""
Response.Write(IsEmpty(strTmp)) ' 返回 Flase

3、IsNull()
Null 值指出变量不包含有效数据。Null 与 Empty 不同,后者指出变量未经初始化。Null 与零长度字符串 ("") 也不同,零长度字符串往往指的是空串。

使用 IsNull 函数可以判断表达式是否包含 Null 值。

例:

a)Dim strTmp

Response.Write(IsNull(strTmp)) ' 返回 False

b)Response.Write(IsNull(strTmp)) ' 返回False 注意这里strTmp是一个未经声明的变量

a)Dim strTmp
strTmp = Null

Response.Write(IsNull(strTmp)) ' 返回 True

a)Dim strTmp
strTmp = Empty

Response.Write(IsNull(strTmp)) ' 返回 False
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: