substr()

Scalar. Returns a substring of a given string, based on a start position and number of characters.

Syntax

substr ( string, position, number )

Parameters

string

A string.

position

The starting position to start taking a substring. The first character or space in a string is in position 0.

number

The number of characters in the substring.

Usage

Returns a substring of a given string, based on a start position and number of characters. The first argument must be a string, and the position and number arguments must be integers. The function returns a string.

Example

substr ('thissubstring', 4, 3) returns 'sub'.