NAME

mid$ - replace part of a string

SYNOPSIS

mid$(StrVar, NumExpr1[, NumExpr2]) = StrExpr

DESCRIPTION

The mid$ statement replaces the characters in StrVar, beginning at position NumExpr1, with characters in StrExpr.  StrVar must be a string variable or array element.  StrExpr may be any string expression.  NumExpr1 may be any numeric expression with a positive value.  NumExpr2 is optional.  If present, it must be a numeric expression with a non-negative value.  NumExpr2 refers to the number of characters from StrExpr that will be used in the replacement.  If NumExpr2 is omitted, all of StrExpr is used.  The length of StrVar does not change, regardless of whether NumExpr2 is omitted or included, or whether StrExpr is either greater or less than StrVar in length. 

EXAMPLE

This example uses the mid$ statement to replace characters in a string. 
	v$ = "CLEVELAND, OHIO"
	x$ = "DREAM CITY"
	mid$(v$, 1, 5) = x$
	print v$
This example produces the output
	DREAMLAND, OHIO
Note that the length of v$ was not changed. 

SEE ALSO

left$, right$, mid$(func)

DIAGNOSTICS

An "Illegal function call" error occurs if either NumExpr1 or NumExpr2 is out of range. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber