Comparer.FromCulture
Syntax
Comparer.FromCulture(culture as text, optional ignoreCase as nullable logical) as function
About
Returns a comparer function that uses the culture
and the case-sensitivity specified by ignoreCase
to perform comparisons.
A comparer function 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.
The default value for ignoreCase
is false. The culture
should be one of the locales supported by the .NET framework (for example, "en-US").
Example 1
Compare "a" and "A" using "en-US" locale to determine if the values are equal.
Usage
Comparer.FromCulture("en-US")("a", "A")
Output
-1
Example 2
Compare "a" and "A" using "en-US" locale ignoring the case to determine if the values are equal.
Usage
Comparer.FromCulture("en-US", true)("a", "A")
Output
0
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