xcall MIAMEX, MX_STRCMP, s1, s2, flags, result
MX_STRCMP (MIAMEX 174) compares two strings in various ways.
Parameters
s1, s2 (String) [in]
are the strings to compare. Only the first 256 characters are considered.
flags (Num) [in]
may be set to one or more of the following:
Symbol |
Value |
Meaning |
---|---|---|
STRCMPF_LDF |
&h01 |
Use LDF collating sequence |
STRCMPF_NAT |
&h02 |
Use "natural" compare (see "natural sort" above) |
STRCMPF_FOLD |
&h04 |
Case insensitive comparison |
Definition file: ashell.def |
result (Signed Num) [out]
Value |
Meaning |
---|---|
<0 |
s1 < s2 |
>0 |
s1 > s2 |
0 |
s1 = s2 |
Comments
With flags=0, you should get nearly the same results as in the standard BASIC string comparison, except that BASIC string comparison ignores trailing blanks, while MX_STRCMP only ignores them if the "natural" flag is set.
The standard BASIC string comparison does not take into account the LDF collating sequence, so for example it will treat accented characters as sorting above the non-accented equivalent.
Unless you modify the LDF accordingly, the standard LDF collating sequences do not change the order of the ASCII characters 1-127, so even with the LDF option, lower case characters are treated as being greater than upper case.
You can check the status of the collating sequences in your LDF file by using DUMP xxxxxx.ldf; the lower collating sequence starts at offset CE in the first block, and the upper collating sequence starts at offset CC in the second block. Or, you can use the sample program GTLANG in EXLIB:[908,49].