Page 1 sur 1

compare

MessagePublié: 30 Jan 2005 à 12:46
par oguruma
Public Class BasicComparator As Comparator

' A simple comparators that compares variables of the same kind

Public Function compare(e1 As Variant, e2 As Variant) As Integer
' An object is always greater than non-objects.
' Two objects can not be compared to each other, yet. They always are equal.
compare = +1
If Isobject(e1) Then
If Not Isobject(e2) Then Exit Function
Else
compare = -1
If Isobject(e2) Then Exit Function
If e1 < e2 Then Exit Function
compare = +1
If e1 > e2 Then Exit Function
End If
compare = 0
End Function
End Class