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
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for