OpenBI Docs Buy

Comparer.OrdinalIgnoreCase

Compares two values exactly, except that capitals and small letters count as the same.

Group: Splitters, combiners, replacers and comparers. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Comparer.OrdinalIgnoreCase(x as any, y as any) as number
ParameterTypeDescription
xanyThe first value.
yanyThe second value.

Returns

number. -1 when x comes first, 0 when they are equal apart from case, 1 when y comes first.

Remarks

  • Letters beyond English ones too: Æ, Ø and Å match æ, ø and å, Ł matches ł. Each character is compared as its capital, so ß does not match SS.
  • Pass it where a function takes a comparer: List.Sort, List.Distinct, List.Contains and others.

Examples

Sorting without regard to case

List.Sort({"banana", "Apple", "Cherry"}, Comparer.OrdinalIgnoreCase)
{"Apple", "banana", "Cherry"}

One of each shop, whatever its capitals

List.Distinct({"Oslo", "OSLO", "Bergen"}, Comparer.OrdinalIgnoreCase)
{"Oslo", "Bergen"}

Norwegian letters

Comparer.OrdinalIgnoreCase("ÆRØ", "ærø")
0

Comparer.Ordinal, Comparer.FromCulture, Comparer.Equals, List.Distinct.

Last updated · OpenBI Studio 0.3.79