MID

Top  Previous  Next

Action

The MID function returns part of a string (a sub string).

The MID statement replaces part of a string variable with another string.

 

 

Syntax

var = MID(var1 ,st [, l] )

MID(var ,st [, l] ) = var1

 

 

Remarks

var

The string that is assigned.

Var1

The source string.

st

The starting position.

l

The number of characters to get/set.

 

 

See also

LEFT , RIGHT

 

 

Example

Dim S As String * 15 , Z As String * 15

S ="ABCDEFG"

Z = Left(s , 5)

Print Z                                                     'ABCDE

Z = Right(s , 3) : Print Z

Z = Mid(s , 2 , 3) : Print Z

End