Mid Command

Purpose

Moves a string expression of specified length to the chosen place in a character string.

Syntax

Mid$(a$, p% [,l%]) = b$

a$:svar
b$:sexp
p%, l%:integer expression

Description

Mid$(a$, p%, l%)=b$ moves l% characters from b$, to position p% (in a$) to a$. If l% is left out, again, as many characters as possible are moved from b$ to a$. The length and address of a$ are not changed.

Example

OpenW # 1 : Win_1.FontName = "courier new"

Local a$ = String$(15, "-")

Local b$ = "Hello GFA"

Print a$``Len(a$)    // Prints --------------- 15

Print b$``Len(b$)    // Prints Hello GFA 9

Mid$(a$, 3) = b$

Print a$``Len(a$)    // Prints --Hello GFA---- 15

Mid$(a$, 9, 5) = b$

Print a$``Len(a$)    // Prints --Hello Hello-- 15

See Also

Lset, Rset

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