Share via


List.Contains

Syntax

List.Contains(list as list, value as any, optional equationCriteria as any) as logical 

About

Indicates whether the list list contains the value value. Returns true if value is found in the list, false otherwise. An optional equation criteria value, equationCriteria, can be specified to control equality testing.

Example 1

Find if the list {1, 2, 3, 4, 5} contains 3.

Usage

List.Contains({1, 2, 3, 4, 5}, 3)

Output

true

Example 2

Find if the list {1, 2, 3, 4, 5} contains 6.

Usage

List.Contains({1, 2, 3, 4, 5}, 6)

Output

false

Example 3

Ignoring case, find if the list contains "rhubarb".

Usage

List.Contains({"Pears", "Bananas", "Rhubarb", "Peaches"},
    "rhubarb",
    Comparer.OrdinalIgnoreCase
)

Output

true

Equation criteria