0

contains

To check if a string or an array contains an exact match

This function helps you to check if a given string or array of any length contains the exact match you are looking for.

In case you are not only searching for a specific string or array but also need its position, you can use the index() function.

ℹ️ The result is true (Yes) for an exact match or false (No) for no exact match found.

Strings

This is case-sensitive, so you can use upper() or lower() to format your text first. contains() can be used to search for keywords in text fields or to determine if a specific option was selected in a multiple-choice field.

Arrays

An exact match means the searched value is equal to one of the array items.

Syntax

contains(string, string)

contains([any], any)

Return

boolean

Examples

contains(myText, match) to check if a given string contains an exact match.

Strings

contains("Hello world!", "Hello") contains("Hello world!", "Hello")

Result: Yes (true)

contains("Hello world!", "hello")contains("Hello world!", "hello")

Result: No (false)

contains(lower("Hello world!"), "hello")contains(lower("Hello world!"), "hello")

Result: Yes (true)

Arrays

contains([myArray], match) to check if a given array contains an exact match.

contains(["A", "B", "C"], "B")contains(["A", "B", "C"], "B")

Result: Yes (true)

contains([{ name: "Sam" }], { name: "Sam" })contains([{ name: "Sam" }], { name: "Sam" })

Result: No (false)

JSON objects are not matched by their content but by their identity.

See also

index which returns the first position of a searched match in a string or an array.

Reply

null