Mid (Statement)

Overwrites a substring of a string with another

Syntax
	KeyPgDeclareDeclare KeyPgSubSub Mid ( KeyPgByrefByRef text KeyPgAsAs KeyPgStringString, KeyPgByvalByVal start KeyPgAsAs KeyPgIntegerInteger, KeyPgByvalByVal 
	length KeyPgAsAs KeyPgIntegerInteger, KeyPgByrefByRef expression KeyPgAsAs KeyPgConstQualifierConst KeyPgStringString )
	KeyPgDeclareDeclare KeyPgSubSub Mid ( KeyPgByvalByVal text KeyPgAsAs KeyPgWstringWString KeyPgPtrPtr, KeyPgByvalByVal start KeyPgAsAs KeyPgIntegerInteger, 
	KeyPgByvalByVal length KeyPgAsAs KeyPgIntegerInteger, KeyPgByvalByVal expression KeyPgAsAs KeyPgConstQualifierConst KeyPgWstringWString KeyPgPtrPtr )

Usage
	Mid( text, start ) = expression
		Or
	Mid( text, start, length ) = expression

Parameters
	text
		The string to work with.
	start
		The start position in text of the substring to overwrite. The first 
		character starts at position 1.
	length
		The number of characters to overwrite.

Description
	Copies a maximum of length characters of expression into text, starting 
	at start.

	If length is not specified, all of expression is copied. The size of the 
	string text is unchanged; if expression is too big, as much of it is 
	copied up to the end of text.

	Mid can also be used as a function to return part of another string.  
	See KeyPgMidfunctionMid (Function).

Example
	Dim text As String

	text = "abc 123"
	Print text 'displays "abc 123"

	' replace part of text with another string
	Mid(text, 5, 3) = "456" 
	Print text 'displays "abc 456"

Differences from QB
	* None

See also
	* KeyPgMidfunctionMid (Function)

