Navigation:  thinBasic Modules > Core > String handling > MID >

MID$ Statement

Previous pageReturn to chapter overviewNext page

 

Description

 

Replace characters in a variable string with data 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 characters from the end of the string.

ByLen

Number

Yes

If ByLen is included, it determines how many characters 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$, LEFT$, RIGHT$,

 

Examples

 

 

 

 

 

© 2004-2008 thinBasic. All rights reserved. Version 1.7.0.0 Web Site: http://www.thinbasic.com