Mid Function

Purpose

Starting from position p, returns the next m characters of a string expression.

Syntax

Mid[$](a$, p% [,m%])

a$:sexp
m%, p%:integer expression

Description

Mid$(a$, p%, m%) returns, starting from position p% (inclusive), up to m% characters of the string expression a$. If m% is not given, the whole string from position p% is returned.

Example

OpenW # 1

Print Mid$("Hello GFA", 7, 5// Prints GFA

Print Mid$("Hello GFA", 1, 5// Prints Hello

Print Mid$("Hello GFA", 3)     // Prints llo GFA

Remarks

Without the optional $ character the function still returns a String data type and not a Variant.

See Also

String, Left$(), Right$(), SubStr()

{Created by Sjouke Hamstra; Last updated: 20/06/2017 by James Gaite}