--- title: "substring (Extract a section of text)" slug: "calc-function-substring" updated: 2026-05-12T12:38:11Z published: 2026-05-12T12:38:11Z canonical: "docs.lobstersoftware.com/calc-function-substring" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # substring (Extract a section of text) *See also*: [length (Text length)](/v1/docs/en/calc-function-length) > [!NOTE] > The $substring() function extracts a part of the transferred text. This section is defined by specifying a start and end index. > > > [!TIP] > > Tooltip > > > > Syntax: *$substring(text,startIndex[,endIndex])* > > > > ### Parameter > > > > | Name | Description | > > | --- | --- | > > | `text` | Any text. | > > | `startIndex` | The index of the character where the extract starts. The first character has the index 0. | > > | `endIndex` `(optional)` | The index of the character where the section ends. The character with this index is not itself included. If this parameter is not specified, the section is automatically formed to the end of the text. | > > > > The extracted partial section from the passed text. > > > > Example: $substring(Hello small world,6,12) – returns "small" ## Syntax *$substring(text,startIndex[,endIndex])* ## Parameter | Name | Description | | --- | --- | | text | Any text. | | startIndex | The index of the character where the extract starts. The first character has the index 0. | | endIndex(optional) | The index of the character where the section ends. The character with this index is not itself included. If this parameter is not specified, the section is automatically formed to the end of the text. | ## Return value The extracted part of the transferred text. ## Examples | Syntax | Result | | --- | --- | | $substring(Hello small world,6,12) | small | | $substring(Hello small world,6) | small world |