Function Comparisons Class

EqualLikeDataTypeFast

Return True if the values vOne and vTwo equal each other, otherwise return False. Compares values with similar data types, but never considers strings equal to numbers. Faster version of the EqualLikeDataType function which has more-restrictive argument types.

Signature (Visual Basic / VBA)

Public Function EqualLikeDataTypeFast( _
      ByRef vOne As Variant _
    , ByRef vTwo As Variant _
    , ByRef vCompare As VbCompareMethod _
    ) As Boolean

Code Examples

    EqualLikeDataTypeFast("ALL", "all", vbBinaryCompare) = False
    EqualLikeDataTypeFast("all", "ALL", vbBinaryCompare) = False
    EqualLikeDataTypeFast("ALL", "all", vbTextCompare) = True
    EqualLikeDataTypeFast("3", 3, vbTextCompare) = False
    True  if vOne =  vTwo
    False if vOne <> vTwo
          vTwo
           D S
    vOne D n F
         S F s
    D = Date/Numeric
    S = String
    F = Return False
    s = Do String comparison with StrComp
    n = Do numeric/Date comparison

Parameters

Parameter Description
vOne First of two values to be compared.
vTwo Second of two values to be compared.
vCompare Specifies the comparison type and sort order/collating sequence used when comparing string values.

Notes & Version History

Function returns See the following table which describes how comparisons are made depending upon data type of arguments.
Summary With Number/Date and Number/Date, use numeric comparison. With Number/Date and String, COMPARE THE VARTYPE. With String and String, use string comparison.