Comparer.Equals
Syntax
Comparer.Equals(comparer as function, x as any, y as any) as logical
About
Returns a logical
value based on the equality check over the two given values, x
and y
, using the provided comparer
.
comparer
is a Comparer
which is used to control the comparison. A comparer is a function that accepts two arguments and returns -1, 0, or 1 based on whether the first value is less than, equal to, or greater than the second. Comparers can be used to provide case-insensitive or culture and locale-aware comparisons.
The following built-in comparers are available in the formula language:
- Comparer.Ordinal: Used to perform an exact ordinal comparison
- Comparer.OrdinalIgnoreCase: Used to perform an exact ordinal case-insensitive comparison
- Comparer.FromCulture: Used to perform a culture-aware comparison
Example 1
Compare "1" and "A" using "en-US" locale to determine if the values are equal.
Usage
Comparer.Equals(Comparer.FromCulture("en-US"), "1", "A")
Output
false
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho