This article will introduce in detail the differences between ASP hollow strings, IsNull, and IsEmpty. Friends in need can refer to the following instructions: set aa=server.createobject(ddd)
isnull indicates that the pointer is null, and the pointer points to an invalid location, that is, the object does not exist.
isempty indicates that the pointer points to a valid location, but the value is empty
1. Empty string
example:
Copy the code code as follows:
a) Dim strTmp
response.write(strTmp=) 'return true
b) response.write(str=) ' returns true
c)Dim strTmp
strTmp=
response.write(strTmp=) 'return true
These lines of code indicate that in ASP, whether it is a variable that has not been declared or a variable that is declared but not assigned a value, ASP considers it to be an empty string or a zero-length string.
2.IsEmpty()
If the variable is not initialized or explicitly set to Empty, the function IsEmpty returns True;
Otherwise the function returns False. If expression contains more than one variable, False is always returned.
example:
Copy the code code as follows:
a) Dim strTmp
Response.Write(IsEmpty(strTmp)) ' Return True
b) Dim strTmp
strTmp = Null
Response.Write(IsEmpty(strTmp)) 'Return Flase
c)Dim strTmp
strTmp = Empty
Response.Write(IsEmpty(strTmp)) ' Return True
d)Dim strTmp
strTmp =
Response.Write(IsEmpty(strTmp)) 'Return Flase
3. IsNull()
A Null value indicates that the variable does not contain valid data. Null is different from Empty, which indicates that the variable is not initialized. Null is also different from zero-length string (), which often refers to the empty string.
Use the IsNull function to determine whether an expression contains a Null value.
example:
Copy the code code as follows:
a) Dim strTmp
Response.Write(IsNull(strTmp)) ' Return False
b) Response.Write(IsNull(strTmp)) ' Return False Note that strTmp is an undeclared variable
a) Dim strTmp
strTmp = Null
Response.Write(IsNull(strTmp)) ' Return True
a)Dim strTmp
strTmp = Empty
Response.Write(IsNull(strTmp)) ' Return False