# `endsWith`

## Description

Returns `true` if a string ends with a given substring, otherwise return `false`.

Note

Unlike `contains`, which checks for a substring anywhere in the string, `endsWith` only matches the end.

## Syntax

Like many functions in DataPrime, `endsWith` supports [two notations](https://coralogix.com/docs/dataprime/language-reference/functions-reference/index.md), **function** and **method** notation. These interchangeable forms allow flexibility in how you structure expressions.

```dataprime
endsWith(value: string, suffix: string): bool
```

```dataprime
(value: string).endsWith(suffix: string): bool
```

## Arguments

| Name   | Type   | Required | Description                                          |
| ------ | ------ | -------- | ---------------------------------------------------- |
| value  | string | **true** | The string to test                                   |
| suffix | string | **true** | The substring to match against the end of the string |

## Example

**Check if an AWS ARN refers to a known S3 bucket**

AWS S3 ARNs look like this:

```text
arn:aws:s3:::mybucket
```

To verify if the ARN points to `mybucket`, use `endsWith`:

### Example query

```dataprime
create is_my_bucket from endsWith(arn, 'mybucket')
```

```dataprime
create is_my_bucket from arn.endsWith('mybucket')
```

### Example output

```json
{
    "arn": "arn:aws:s3:::mybucket",
    "is_my_bucket": true
}
```
