Check nothing in vbscript / classic asp

I need to update the old classic asp, and I need to call a function that usually returns an array, but under certain circumstances can return a value Nothingor undefined.

How can I verify that the result actually returns an array?

+3
source share
6 answers

Is the function late bound / has a return value Variant? If so, the function IsArraychecks to see if it contains an array type.

+4
source

er ... I could be wrong, but isn't it just something like

If something Is Nothing Then
   'Do something here
Else
   'Do what I used to
End If
+4
source

IsNull() , .

+2

TypeName (something) = "Empty" Then  ...

+1

, !

Function IsNothingType( ByRef obj )
    If TypeName(obj) = "Nothing" Then
        IsNothingType = True
    Else
        IsNothingType = False
    End If  
End Function
0

If you use VBScript / WSH, you may need to try the "typeof" function / method. This worked for me while it wasn’t higher.

-1
source

Source: https://habr.com/ru/post/1706902/


All Articles