substring (Extract a section of text)

See also: length (Textlänge)

The $substring() function extracts a part of the transferred text. This section is defined by specifying a start and end index.

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