---
title: "gsql_substring()"
component: "gsql-ref"
version: "4.3"
module: "ddl-and-loading"
html_url: "/gsql-ref/4.3/ddl-and-loading/functions/token/gsql_substring"
canonical_url: "https://www.tigergraph.com/docs/gsql-ref/4.3/ddl-and-loading/functions/token/gsql_substring"
markdown_url: "https://www.tigergraph.com/docs/gsql-ref/4.3/ddl-and-loading/functions/token/gsql_substring.md"
---

[View as HTML](https://www.tigergraph.com/docs/gsql-ref/4.3/ddl-and-loading/functions/token/gsql_substring)

# gsql_substring()

Returns the substring of a string beginning at a specified index. Optionally, you can specify a length for the substring.

## Syntax

`gsql_substring(str, begin_index [, length])`

## Parameters

str

Required. The string from which to obtain substring.

begin\_index

Required. The index of the first character to include in the returned substring.

length

Optional. The length of the substring. If the parameter is not specified, the substring goes from the beginning index to the end of the original string.

## Return type

`STRING`

## Example

For the following CSV file:

```csv
Name,DOB
Taylor,1988-04-25
```

The function returns the following results:

gsql_substring($"Name", 1, 3) -> "ayl"
