Syntax
CONTAINS(<string or list>;<string>)
Description
Returns a Boolean value if the string contains the desired characters (2nd argument) or not. This operation is case-sensitive. CONTAINS returns false if one of the arguments is <null>.
Examples
Column1 (string) | Contains | CONTAINS returns |
---|---|---|
United States | "united states" | false |
United States | "United" | true |
Germany | "Germany" | true |
Germany | "ger" | false |
United Kingdom | "King" | true |
<null> | "King" | false |
United Kingdom | <null> | false |
If the data you are using in your CONTAINS () function is a list format data field, the string used to evaluate the element must match the entire element.
Column1 (list) | Contains | CONTAINS returns |
---|---|---|
[United States, Germany] | "United" | false |
[United States, Germany] | "United States" | true |
[United States, Germany] | "germany" | false |
[United States, Germany] | "Ger" | false |
[United States, Germany] | "Germany" | true |
If you have a list data type and want to be able to use the CONTAIN() like a string, you can use TOJSON(), as in the following example.
...