'------------------------------------------------------------------------------- Public Function StrComp( _ ByVal S1 As String, _ ByVal S2 As String) As Integer ' This function compares 2 strings S1 and S2. Both the lengths and contents ' of each string are compared. Function return values: ' ' Function ' Condition Return ' ' S1 < S2 -1 ' S1 = S2 0 ' S1 > S2 1 ' ' This function emulates the VB function of the same name, and assumes the ' equivalent of "Option Compare Binary", which is the default in VB, and ' which means that comparisons are case sensitive. Dim L1 As Byte Dim C1 As Byte Dim L2 As Byte Dim C2 As Byte Dim Length As Byte Dim N As Byte L1 = RAMPeek(MemAddressU(S1)) L2 = RAMPeek(MemAddressU(S2)) ' Pick the shorter length. If (L1 < L2) Then Length = L1 Else Length = L2 End If ' Compare string contents. For N = 1 To Length C1 = RAMPeek(MemAddressU(S1) + CuInt(N) + 1) C2 = RAMPeek(MemAddressU(S2) + CuInt(N) + 1) StrComp = CInt(C1) - CInt(C2) If (StrComp <> 0) Then GoTo ExitNode End If Next ' Compare string lengths. StrComp = CInt(L1) - CInt(L2) ExitNode: If (StrComp > 0) Then StrComp = 1 ElseIf (StrComp < 0) Then StrComp = -1 End If ' At this point, StrComp is either -1, 0 or +1. End Function '-------------------------------------------------------------------------------