All About Variables Part 3 : Checking for specific SubTypes
[Part 1 | Part 2 | Part 3]
There are six different functions that will assist you in determining if a
particular variable is one Subtype or another. Below I have listed all of
the SubType checking functions:
All of the above functions return a boolean value (true or false). Some of
the above are self explanatory, however a few are not as clear. I will go
over the ones that need explaining:
IsEmpty(VariableToCheck)
What makes a variable empty? If the variable has been created, but has not been
assigned a value yet it is considered to be empty. This is different from a value that
is empty ("") or equal to NULL.
IsNull(VariableToCheck)
What makes a variable null? A variable is null only when it equals null. You can
set a variable equal to null.
IsNumeric(VariableToCheck)
This will return true if the variable can be converted to a numeric SubType without
generating an error.
Example:
myVar = "Hello"
If IsNumeric(myVar) Then
Response.Write("Variable is numeric.")
Else
Response.Write("Variable is NOT numeric.")
End If Result:
Variable is NOT numeric.
Another way to determine the variable SubType is the VarType() function.
Syntax:
VarType(VariableToCheck)
The above function will return a number representing the various subtypes. I have listed them
for you below: