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.An exact match means the searched value is equal to one of the array items.
contains(string, string)
contains([any], any)
boolean
contains(myText, match)
to check if a given string contains an exact match.1
contains("Hello world!", "Hello")
Result: Yes (
true
)
1
contains("Hello world!", "hello")
Result: No (
false
)
1
contains(lower("Hello world!"), "hello")
Result: Yes (
true
)contains([myArray], match)
to check if a given array contains an exact match.1
contains(["A", "B", "C"], "B")
Result: Yes
(true)
1
contains([{ name: "Sam" }], { name: "Sam" })
Result: No (
false
)JSON objects are not matched by their content but by their identity.
Last modified 4mo ago