# ends\_with

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

Tests whether a string ends with another string.

## Syntax

```scopeql
ends_with(<string>, <suffix>)
```

## Arguments

| Argument   | Type     | Description      |
| ---------- | -------- | ---------------- |
| `<string>` | `string` | String to test.  |
| `<suffix>` | `string` | Suffix to match. |

## Returns

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

## Examples

Filter file events to PDF receipts using the path suffix.

```scopeql
VALUES
    ('/receipts/order-17.pdf'), ('/receipts/order-42.pdf'), ('/uploads/cart.jpg')
SELECT $0 AS path
WHERE ends_with(path, '.pdf')
SELECT path
```

```text
+------------------------+
| path                   |
+------------------------+
| /receipts/order-17.pdf |
| /receipts/order-42.pdf |
+------------------------+
```

Normalize case first if file extensions arrive with inconsistent capitalization.
