MID$ Statement

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > BuiltIn Functions > String functions >

MID$ Statement

 

Description

 

Replace bytes in a variable string with bytes from another string expression.

 

Syntax

 

MID$(StringVariable, PositionStart [, ByLen]) = StringExpression

 

Returns

 

None

 

Parameters

 

Name

Type

Optional

Meaning

StringVariable

String

No

String inside which will take place MID substitution

PositionStart

Number

No

Position inside StringVariable where substitution will start. If PositionStart is negative, the starting position is assumed to be PositionStart bytes from the end of the string.

ByLen

Number

Yes

If ByLen is included, it determines how many bytes of replacement string are inserted into StringVariable.

If ByLen is omitted, all of replacement string is used. If ByLen is negative, it is interpreted as: LEN(StringVariable)-ABS(ByLen).

 

Remarks

 

The replacement will never extend past the end of the original string_variable.

MID$ never alters the length of a string.

For a similar function that can alter the length of a string, please refer to the REPLACE$ function.

 

Restrictions

 

See also

 

String Handling, MID$, MIDF$, LEFT$, RIGHT$, MIDW$

 

Examples