preload

QTP Math functions – Check Array Type

Posted by Albert Gareev on Feb 15, 2008 | Categories: MathSource code

Parent page: Service Functions – Math (QTP, VBScript)

Check whether an array consists of numeric values

Public Function isArrayNumeric(ByVal dvArray)
  Dim Iter
 
  If Not isArray(dvArray) Then
    isArrayNumeric = False
    Exit Function
  End If
  If UBound(dvArray) = -1 Then
    isArrayNumeric = False
    Exit Function
  End If
 
  For Iter=0 To UBound(dvArray)
    If Not isNumeric(dvArray(Iter)) Then
      isArrayNumeric = False
      Exit Function
    End If
  Next

  isArrayNumeric = True
End Function

Check whether an array consists of date/time values

Public Function isArrayDate(ByVal dvArray)
  Dim Iter
 
  If Not isArray(dvArray) Then
    isArrayDate = False
    Exit Function
  End If
  If UBound(dvArray) = -1 Then
    isArrayDate = False
    Exit Function
  End If
 
  For Iter=0 To UBound(dvArray)
    If Not isDate(dvArray(Iter)) Then
      isArrayDate = False
      Exit Function
    End If
  Next

  isArrayDate = True
End Function


Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.