Mid

Extracts a sub-string of a character string.

Syntax

Mid(string, start, num_chars)
STxt(string, start, num_chars)
string = character string from which you want to extract a sub-string
start = position of the first character (base 1)
num_chars = the number of characters to extract

Remarks

If num_chars is larger than the available number of characters, it will automatically be reduced.
If start is less than 1, it will be understood as 1.
If start is after the end of the string, the function will return an empty string.

See also: Right if you want to extract the right part of the string, or Left for the left part.

Examples

Mid("apple", 2, 3) = "ppl"
Mid("apple", 5, 4) = "e"
Mid("apple", 15, 2) = "" (empty string)
Mid("apple", 2, 3) = "ppl"

Classification

Strings