Menu
Amazon QuickSight
User Guide

substring Function

substring returns the characters in a string, starting at the location specified by the start argument and proceeding for the number of characters specified by the length arguments.

Syntax

Copy
substring(expression, start, length)

Arguments

expression

An expression can be the name of a field that uses the string data type like address1, a literal value like 'Unknown', or another function like substring(field_name,0,5).

start

The character location to start from. start is inclusive, so the character at the starting position will be the first character in the returned value.

length

The number of additional characters to include after start. length is inclusive of start, so the last character returned will be length - 1 after the starting character.

Return Type

String

Example

The following example returns the 13th through 19th characters in a string.

Copy
substring('Fantasy and Science Fiction',13,7)

The following value is returned:

Copy
Science