Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fstring%2Fstartswith.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Fstring%2Fstartswith.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `startsWith`

## Description

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

Note

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

## Syntax

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

* Function notation
* Method notation

```
startsWith(value: string, prefix: string): bool
```

```
(value: string).startsWith(prefix: string): bool
```

## Arguments

| Name     | Type     | Required | Description                                                |
| -------- | -------- | -------- | ---------------------------------------------------------- |
| `value`  | `string` | **true** | The full string to test (haystack)                         |
| `prefix` | `string` | **true** | The substring to check at the start of the string (needle) |

## Example

**Check if a string is an AWS ARN**

AWS ARNs look like this:

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

To confirm if a value is an ARN, check if it starts with `arn:`:

### Example query

* Function notation
* Method notation

```
create is_arn from startsWith(resource_id, 'arn:')
```

```
create is_arn from resource_id.startsWith('arn:')
```

### Example output

```
{

    "resource_id": "arn:aws:s3:::mybucket",

    "is_arn": true

}
```
