Text.Contains

Syntax

Text.Contains(text as nullable text, substring as text, optional comparer as nullable function) as nullable logical

About

Detects whether text contains the value substring. Returns true if the value is found. This function doesn't support wildcards or regular expressions.

The optional argument comparer can be used to specify case-insensitive or culture and locale aware comparisons. The following built-in comparers are available in the formula language:

  • Comparer.Ordinal: Used to perform a case-sensitive ordinal comparison
  • Comparer.OrdinalIgnoreCase: Used to perform a case-insensitive ordinal comparison
  • Comparer.FromCulture: Used to perform a culture-aware comparison

Example 1

Find if the text "Hello World" contains "Hello".

Text.Contains("Hello World", "Hello")

true

Example 2

Find if the text "Hello World" contains "hello".

Text.Contains("Hello World", "hello")

false

Example 3

Find if the text "Hello World" contains "hello", using a case-insensitive comparer.

Text.Contains("Hello World", "hello", Comparer.OrdinalIgnoreCase)

true