<-- Previous || Up || Next -->

Min 2 Function
Comparisons Class

Public Function Min2( _
      ByVal vOne As Variant _
    , ByVal vTwo As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

"Minimum of Two Values"
Return the minimum of two arguments.
Returns the argument on the left (vOne) if arguments are equal.

    Min2(23, 45) = 23
    Min2("ST", "SC") = "SC"
    Min2("ST", "sc") = "ST"
    Min2("ST", "sc", vbTextCompare) = "SC"
    IsNull(Min2(12, Null)) = True
    IsNull(Min2(Null, "SF")) = True
See also:
    Min2Real Function
    Min2Variant Function
    Max2 Function
    StrComp Function (Visual Basic)
Summary: Function returns Null if either argument is Null. Function uses string comparisons if either argument is a string. Function uses numeric comparisons if both arguments are numeric.

vOne: First of two values, the minimum of which will be returned. Function returns Null if vOne is Null.
vTwo: Second of two values, the minimum of which will be returned. Function returns Null if vTwo is Null.
vCompare: Specifies the type of comparisons used to determine if strings match when comparing string arguments. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.
Note: This function DOES support three-valued logic because if either argument (vOne or vTwo) is Null this function will return Null. This function does NOT support arguments whose types are other than Empty, Null, String, or numeric. For example, passing an Object pointer to this function will cause it to generate a runtime error.
Note: If a string is compared to a number, and the number (when represented in string form) is "less" than the string, the number will be returned in string form.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.