ChadSmiley Blog Things about family, life, coding, and more

5Jan/050

Comparing StrCompare and @Compare

The StrCompare and @Compare are considered 'Language cross-reference' according to Designer Help. When using the compares you should get the following results:

Strings being compared
StrCompare result
@Compare
Either string is NULL
NULL
string1 is less than string2
-1
-1
string1 equals string2
0
0
string1 is greater than string2
1
1

Now use the following strings and the results are different. The only character that is different is the special characters. I would assume that all non number and letters would have the same reults.

String1 String2
StrCompare Results
@Compare Results
MailArchivensf Mailnsf
-1
-1
MailArchive.nsf Mail.nsf
1
-1
MailArchive!nsf Mail!nsf
1
-1
MailArchive!nsf Mail!nsf
1
-1
MailArchive#nsf Mail#nsf
1
-1
MailArchive5nsf Mail5nsf
1
1

For now I will be using the following code:

Dim String1 As String, String2 As String
Dim EvalCompare As Variant
Dim CompareResults As Integer
String1 = "MailArchive.nsf"
String2 = "Mail.nsf"
EvalCompare = Evaluate( { @Compare( "} + String1 + {" ; "} + String2 + {" )})
CompareResults = EvalCompare(0)
Tagged as: No Comments