compareGeneric
compareGeneric(rhs: StringUtf8; bIgnoreCase: Boolean; bUseLocale: Boolean; locale: Locale): Integer;
The compareGeneric method of the StringUtf8 primitive type compares the receiver with the value of the rhs parameter and returns one of the following values.
Value | Returned if the receiver is … |
---|---|
Negative integer | Less than the right-hand side value represented by the rhs parameter |
Zero (0) | Equal to the right-hand side value represented by the rhs parameter |
Positive integer | Greater than the right-hand side value represented by the rhs parameter |
Parameters enable you to make the comparison case-sensitive or case-insensitive, and to use the sort order associated with a locale or the strict binary sort order. (These are the same comparison options that you can specify on dictionary keys.)
The relational binary comparison operators (<, <=, =, >=, >, <>), documented in
If the value of the bIgnoreCase parameter is false:
-
A strict binary value comparison is performed if the value of the bUseLocale parameter is also false.
-
A case-sensitive comparison using the sort order of the current locale of the process is performed if the value of the bUseLocale parameter is true and the value of the locale parameter is null.
-
A case-sensitive comparison using the specified locale is performed if the value of the bUseLocale parameter is true and the value of the locale parameter is not null.
If the value of the bIgnoreCase parameter is true:
-
A case-insensitive binary value comparison for characters less than Decimal 254 is performed.
-
A case-insensitive comparison using the sort order of the current locale of the process is performed if the value of the bUseLocale parameter is true and the value of the locale parameter is null.
-
A case-insensitive comparison using the specified locale is performed if the value of the bUseLocale parameter is true and the value of the locale parameter is not null.