I'm hoping someone can shed some light on this for me:
What are the differences, in Delphi 2009, between the CompareStr
(defined in SysUtils) and CompareString
(from Windows API) functions?
Both let you specify the locale to be used, is the Windows one simply more "complete", due to the available comparison flags? Is one consequently faster than the other?
CompareString uses locale information so that things like ae and æ are treated as matches, and sorting is appropriate for the geographical region.
CompareStr('', loInvariantLocale) is just a byte-by-byte comparison of the characters in a string. CompareStr('', loUserLocale) calls CompareString internally, so they're identical, other than the additional flags that CompareString can accept. It's also inlined, so you shouldn't see any difference in speed between it and calling CompareString directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With