---
title: "substring function in Strata | Oplema"
description: "Extract part of text, starting at a character position where 1 is the first character. For example, substring('Hello', 2) returns 'ello'."
url: "https://oplema.com/docs/strata/functions/substring"
updated: "2026-11-04"
---

# substring

Extract part of text, starting at a character position where 1 is the first character. Without a length, it continues to the end of the text.

Also available as substr.

## Try an expression

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

### Expression

```
substring('Hello', 2)
```

### Result

```
'ello'
```

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

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | ello |

## Arguments and types

```
substring(string, start, length)
```

**string**

Text

**start**

Number

**length**

Number

Supported signatures (2)

```
substring(string: VARCHAR, start: BIGINT) → VARCHAR
substring(string: VARCHAR, start: BIGINT, length: BIGINT) → VARCHAR
```

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

## Things to know

Positions start at 1. Supply a third argument to limit the number of characters.

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

### Limit the length

```
substring('Hello', 2, 2)
```

'el'

## Related functions

[substring\_grapheme

Extracts substring starting from grapheme clusters start up to the end of the string. If optional argument length is set, extracts a substring of length grapheme clusters instead. Note that a start value of 1 refers to the first character of the string.

](https://oplema.com/docs/strata/functions/substring-grapheme)[translate

Swap individual characters: each character in the second argument becomes the character at the same position in the third. Characters with no counterpart are removed.

](https://oplema.com/docs/strata/functions/translate)[array\_extract

Get one item from a list or one character from text by position, where 1 is the first. For a struct, choose a field by name, or by position in an unnamed struct.

](https://oplema.com/docs/strata/functions/array-extract)[ascii

Return the Unicode number of the first character in text.

](https://oplema.com/docs/strata/functions/ascii)

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

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