Mid Function

Syntax

String Mid(String string, Number startIndex, [Number numberOfCharacters])

Return Value

String

A new string that contains the specified characters from the original string.

Purpose

This function retrieves a substring from the string beginning at the specified index.

Parameters

string as String

A string.

startIndex as Number

A number specifying the zero-based starting index of the substring to retrieve.

numberOfCharacters as Number

An optional number specifying the number of characters to retrieve. If you omit this parameter or pass a value greater than the number of characters in the string beyond the starting index, the function returns all the characters from the start index to the end of the string.