The prefix 'Ansi' of string comparison functions never meant anything except that the locale was taken into account when comparing strings instead of doing βjustβ a simple binary comparison. In the Unicode world, this is still the case. The Ansi * family of functions also accepts (Unicode) strings as their parameters and takes into account the locale when comparing.
From AnsiCompareStr Document (D2009):
Most locales consider lowercase characters less than the corresponding uppercase characters. This is in contrast to the ASCII order in which lowercase characters are larger than uppercase characters. So setting S1 to βaβ and S2 to βAβ calls AnsiCompareStr to return a value less than zero, and CompareStr, with the same arguments, returns a value greater than zero.
What is the effect of "accounting locale in accounting" may vary in language. Perhaps this is due to accented characters or not. In versions of Unicode, it can take into account how characters are generated. For example, accented e (Γ©) can be encoded in exactly the same way, but can also be encoded as two separate elements: accent and e.
The SysUtils function includes Ansi * and "normal" comparison functions. They all take strings as their parameters in Unicode Delphi, which really means UnicodeStrings.
If you need to work with AnsiStrings, you need to use the AnsiStrings block. It has the same set of string comparison functions, but on this device they all take AnsiStrings as their parameters.
Now, if you do not need compatibility with older versions: use the standard functions from SysUtils. Use normal if byte comparison is enough. Use Ansi if you need to consider locale considerations.
source share