代码之家  ›  专栏  ›  技术社区  ›  Joel Coehoorn

检查vbscript/Classic ASP中是否无任何内容

  •  3
  • Joel Coehoorn  · 技术社区  · 16 年前

    我需要更新一个旧的经典ASP,并且我必须调用一个通常返回数组的函数,但在某些情况下可能返回 Nothing 或未定义的值。

    如何检查结果是否实际返回数组?

    6 回复  |  直到 8 年前
        1
  •  4
  •   Konrad Rudolph    16 年前

    函数是否延迟绑定/具有 Variant 返回值?如果是这样, IsArray 函数将检查它是否包含数组类型。

        2
  •  4
  •   Powerlord    16 年前

    呃。。。我可能错了,但这不是像

    If something Is Nothing Then
       'Do something here
    Else
       'Do what I used to
    End If
    
        3
  •  2
  •   John M Gant aman_novice    16 年前

    我认为isNull()应该有效。

        4
  •  1
  •   Anonymous    14 年前

    如果typename(something)=“空”,则 …

        5
  •  0
  •   BuvinJ Felix    8 年前

    丑陋,但实用!

    Function IsNothingType( ByRef obj )
        If TypeName(obj) = "Nothing" Then
            IsNothingType = True
        Else
            IsNothingType = False
        End If  
    End Function
    
        6
  •  -1
  •   user314065    15 年前

    如果您使用的是vbscript/wsh,那么您可能需要尝试“typeof”函数/方法。这对我很有用,而上面没有。

    推荐文章