# contains

[Read this page in HTML](https://www.scopedb.io/docs/reference/functions/string/contains)

Tests whether a string contains another string.

## Syntax

```scopeql
contains(<string>, <substring>)
```

## Arguments

| Argument      | Type     | Description         |
| ------------- | -------- | ------------------- |
| `<string>`    | `string` | String to test.     |
| `<substring>` | `string` | Substring to match. |

## Returns

Returns `boolean`: TRUE if `<string>` contains `<substring>`, otherwise FALSE. Returns NULL if either input is NULL. An empty `<substring>` matches every non-NULL string.

## Examples

Check which messages contain the exact lowercase substring `payment`.

```scopeql
VALUES ('payment failed'), ('repayment posted'), ('Payment declined')
SELECT $0 AS message
SELECT message, contains(message, 'payment') AS has_fragment
```

```text
+------------------+--------------+
| message          | has_fragment |
+------------------+--------------+
| payment failed   | true         |
| repayment posted | true         |
| Payment declined | false        |
+------------------+--------------+
```

Substring matching also finds `payment` inside `repayment` and is case-sensitive. Use `search` when you want analyzed words instead.
