Skip to main content

Text.Contains

Returns whether the text contains the substring.

Syntax

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

Remarks

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

Examples

Example #1

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

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

Result:

true

Example #2

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

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

Result:

false

Example #3

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

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

Result:

true

Category

Text.Membership