---
title: "prefix function in Strata | Oplema"
description: "Check whether text begins with a given string. Same as starts_with. For example, prefix('abc', 'ab') returns true. Works in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/prefix"
updated: "2026-11-04"
---

# prefix

Check whether text begins with a given string.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **BOOLEAN**.

### Expression

```
prefix('abc', 'ab')
```

### Result

```
true
```

To use your own data, replace the example values with column names. Keep format strings and other options as written.

This Boolean expression also works in [Filter](https://oplema.com/docs/strata/prep/filter) custom mode. For the literal inputs above, the row goes to the True output. A missing result goes to False.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | true |

## Arguments and types

```
prefix(string, search_string)
```

**string**

Text

**search\_string**

Text

Supported signatures (1)

```
prefix(string: VARCHAR, search_string: VARCHAR) → BOOLEAN
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[starts\_with

Check whether text begins with a given string.

](https://oplema.com/docs/strata/functions/starts-with)[suffix

Check whether text ends with a given string.

](https://oplema.com/docs/strata/functions/suffix)[contains

Check whether text contains a search string. It also checks a list for an item, a map for a key and an unnamed struct for a value.

](https://oplema.com/docs/strata/functions/contains)[ilike\_escape

Check whether text matches a LIKE pattern, ignoring uppercase and lowercase. The escape character lets the pattern search for a literal % or \_.

](https://oplema.com/docs/strata/functions/ilike-escape)

[Browse text](https://oplema.com/docs/strata/functions#text) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/text.html#prefixstring-search_string)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
