Mid$()

Syntax

Mid$(Source$, Start [Count])

Remarks

Returns a portion of Source$ starting at a given character position.

Argument

Explanation

Source$

The original string.

Start

The character position in Source$ where the string you want to return begins.

Count

The number of characters in the string you want to return. If you do not specify Count, the number of characters to the end of the string is assumed.


Example

This example returns the second word of a two-word string:


wholeName$ = "Sanjeev Reddy"
space = InStr(wholeName$, " ")
lastName$ = Mid$(wholeName$, space + 1)

See Also

InStr(), Left$(), Len(), LTrim$(), Right$(), RTrim$()