substring

Modified on Wed, 16 Aug 2023

Description

Extract a substring from the given string by using the index values.

Syntax

substring(text, start, end)

Parameters

Input ParameterTypeDescription
textstringSource string
startNumberThe index of the first character to include in the returned substring
end (optional)NumberThe index of the first character to exclude from the returned substring

Return value

Type
string

Sample

ExampleResultDescription
substring('abcdef', 2, 4)'cd'Extract string from index 2 to 4
substring('abcdef', 2)'cdef'Extract string from index 2

To view all the String functions, click here.